summaryrefslogtreecommitdiff
path: root/app/photos/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/photos/models.py')
-rw-r--r--app/photos/models.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/app/photos/models.py b/app/photos/models.py
index d68cd09..91ac15d 100644
--- a/app/photos/models.py
+++ b/app/photos/models.py
@@ -145,18 +145,21 @@ class LuxImage(models.Model):
return self.get_previous_by_pub_date()
@property
- def get_previous_admin_url(self):
- n = self.get_previous_by_pub_date()
- return "/admin/photos/luximage/%s/change/" % n.pk
-
- @property
def get_next_published(self):
return self.get_next_by_pub_date()
@property
+ def get_previous_admin_url(self):
+ n = self.get_previous_by_pub_date()
+ return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[n.id] )
+
+ @property
def get_next_admin_url(self):
- n = self.get_next_by_pub_date()
- return "/admin/photos/luximage/%s/change/" % n.pk
+ model = apps.get_model(app_label=self._meta.app_label, model_name=self._meta.model_name)
+ try:
+ return reverse('admin:%s_%s_change' %(self._meta.app_label, self._meta.model_name), args=[self.get_next_by_pub_date().pk] )
+ except model.DoesNotExist:
+ return ''
@property
def is_portait(self):