diff options
author | luxagraf <sng@luxagraf.net> | 2020-04-07 09:54:04 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2020-04-07 09:54:04 -0400 |
commit | 426dd7545dbe74c405aed922169ba1d2e9df0892 (patch) | |
tree | a14aff0d571c9262e54d0064e08801b1b8a7432a /app/normalize | |
parent | 0fdb50984668da4f360a0408ba50cb43136d3de9 (diff) |
fixed a bug in how posts save themselves as relatedposts
Diffstat (limited to 'app/normalize')
-rw-r--r-- | app/normalize/admin.py | 13 | ||||
-rw-r--r-- | app/normalize/models.py | 4 |
2 files changed, 15 insertions, 2 deletions
diff --git a/app/normalize/admin.py b/app/normalize/admin.py new file mode 100644 index 0000000..cf67658 --- /dev/null +++ b/app/normalize/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin + +from utils.widgets import AdminImageWidget, LGEntryForm + +from .models import RelatedPost + +@admin.register(RelatedPost) +class RelatedPostAdmin(admin.ModelAdmin): + list_display = ('title', 'slug', 'pub_date', 'model_name') + list_filter = ['model_name'] + + class Media: + js = ('next-prev-links.js',) diff --git a/app/normalize/models.py b/app/normalize/models.py index bcd8eac..f45f90b 100644 --- a/app/normalize/models.py +++ b/app/normalize/models.py @@ -10,8 +10,8 @@ class RelatedPost(models.Model): pub_date = models.DateTimeField('Date published') class Meta: - ordering = ('model_name', '-pub_date',) + ordering = ('-model_name', '-pub_date',) get_latest_by = 'pub_date' def __str__(self): - return self.title + return "%s - %s" % (self.model_name, self.title) |