|
@@ -9,7 +9,6 @@ import logging
|
9
|
9
|
import media
|
10
|
10
|
import os
|
11
|
11
|
import pygal
|
12
|
|
-import subprocess
|
13
|
12
|
import time
|
14
|
13
|
|
15
|
14
|
DEBUG = False
|
|
@@ -306,11 +305,14 @@ class Item(models.Model):
|
306
|
305
|
return user in parent.modify_access.all()
|
307
|
306
|
|
308
|
307
|
def sort_string(self):
|
309
|
|
- try:
|
310
|
|
- tm = int(self.item_data.datetime.strftime('%s'))
|
311
|
|
- except AttributeError:
|
312
|
|
- raise AttributeError('Unable to create a sortstring for %s. Used datetime was: %s' % (str(self), repr(self.item_data.datetime)))
|
313
|
|
- return '%012d_%s' % (tm, os.path.basename(self.rel_path))
|
|
308
|
+ if pygal.sort_by_date():
|
|
309
|
+ try:
|
|
310
|
+ tm = int(self.item_data.datetime.strftime('%s'))
|
|
311
|
+ except AttributeError:
|
|
312
|
+ raise AttributeError('Unable to create a sortstring for %s. Used datetime was: %s' % (str(self), repr(self.item_data.datetime)))
|
|
313
|
+ return '%012d_%s' % (tm, os.path.basename(self.rel_path))
|
|
314
|
+ else:
|
|
315
|
+ return self.rel_path
|
314
|
316
|
|
315
|
317
|
def sorted_itemlist(self):
|
316
|
318
|
if self.type == TYPE_FOLDER:
|
|
@@ -357,7 +359,7 @@ class Item(models.Model):
|
357
|
359
|
|
358
|
360
|
def current_settings(self):
|
359
|
361
|
if self.__current_settings__ is None:
|
360
|
|
- self.__current_settings__ = pygal.show_audio() * 1 + pygal.show_image() * 2 + pygal.show_other() * 3 + pygal.show_video() * 4
|
|
362
|
+ self.__current_settings__ = pygal.show_audio() * 1 + pygal.show_image() * 2 + pygal.show_other() * 4 + pygal.show_video() * 8 + pygal.sort_by_date() * 16
|
361
|
363
|
return self.__current_settings__
|
362
|
364
|
|
363
|
365
|
def __cache_update_needed__(self):
|
|
@@ -413,7 +415,7 @@ class Item(models.Model):
|
413
|
415
|
self.num_videos_c += 1
|
414
|
416
|
# sorted item list
|
415
|
417
|
sil.append(sub_item)
|
416
|
|
- sil.sort(key=lambda entry: entry.sort_string(), reverse=True)
|
|
418
|
+ sil.sort(key=lambda entry: entry.sort_string(), reverse=pygal.sort_by_date())
|
417
|
419
|
self.sil_c = json.dumps([i.rel_path for i in sil], indent=4)
|
418
|
420
|
# datetime
|
419
|
421
|
if len(sil) > 0:
|
|
@@ -466,11 +468,3 @@ class Tag(models.Model):
|
466
|
468
|
"""the url to the Django admin interface for the model instance"""
|
467
|
469
|
info = (self._meta.app_label, self._meta.model_name)
|
468
|
470
|
return reverse('admin:%s_%s_change' % info, args=(self.pk,))
|
469
|
|
-
|
470
|
|
-
|
471
|
|
-class Setting(models.Model):
|
472
|
|
- suspend_puplic = models.BooleanField(default=True)
|
473
|
|
- show_image = models.BooleanField(default=True)
|
474
|
|
- show_video = models.BooleanField(default=True)
|
475
|
|
- show_audio = models.BooleanField(default=False)
|
476
|
|
- show_other = models.BooleanField(default=False)
|