summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/jrnl/models.py11
-rw-r--r--design/templates/admin/jrnl/change_form.html4
2 files changed, 15 insertions, 0 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py
index da953de..a918f6e 100644
--- a/app/jrnl/models.py
+++ b/app/jrnl/models.py
@@ -152,11 +152,22 @@ class Entry(models.Model):
@property
def get_previous_published(self):
return self.get_previous_by_pub_date(status__exact=1)
+
+ @property
+ def get_previous_admin_url(self):
+ n = self.get_previous_by_pub_date()
+ return "/admin/jrnl/entry/%s/change/" % n.pk
+
@property
def get_next_published(self):
return self.get_next_by_pub_date(status__exact=1)
+ @property
+ def get_next_admin_url(self):
+ n = self.get_next_by_pub_date()
+ return "/admin/jrnl/entry/%s/change/" % n.pk
+
def save(self):
if self.pk:
if self.pk >= 167 or self.pk == 129:
diff --git a/design/templates/admin/jrnl/change_form.html b/design/templates/admin/jrnl/change_form.html
index 880e9c9..e3edae0 100644
--- a/design/templates/admin/jrnl/change_form.html
+++ b/design/templates/admin/jrnl/change_form.html
@@ -67,6 +67,10 @@ $(function(){
</ul>
{% endif %}{% endif %}
{% endblock %}
+<ul style="padding-left: 0;">
+ {%if original.get_previous_admin_url %}<li style="display: inline-block;"><a href="{{original.get_previous_admin_url}}">&laquo; prev</a></li>{%endif%} |
+ {%if original.get_next_admin_url %}<li style="display: inline-block;"><a href="{{original.get_next_admin_url}}">next &raquo;</a></li>{%endif%}
+</ul>
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1" />{% endif %}