diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/books/admin.py | 6 | ||||
-rw-r--r-- | app/books/models.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/app/books/admin.py b/app/books/admin.py index 8366510..3faa14e 100644 --- a/app/books/admin.py +++ b/app/books/admin.py @@ -1,10 +1,10 @@ from django.contrib import admin from .models import Book - +from orderable.admin import OrderableAdmin @admin.register(Book) -class BookAdmin(admin.ModelAdmin): - list_display = ('title', 'admin_thumbnail', 'isbn', 'author_last_name') +class BookAdmin(OrderableAdmin): + list_display = ('title', 'admin_thumbnail', 'isbn', 'author_last_name', 'sort_order_display') search_fields = ['title', 'body_markdown'] class Media: diff --git a/app/books/models.py b/app/books/models.py index 2ebc769..0e17621 100644 --- a/app/books/models.py +++ b/app/books/models.py @@ -74,11 +74,11 @@ class Book(Orderable): @receiver(post_save, sender=Book) def post_save_events(sender, update_fields, created, instance, **kwargs): if instance.image: - base_path = "%s/%s/" % (settings.IMAGES_ROOT, "/".join(str(i) for i in instance.image.name.split('/')[1:-1])) + base_path = "%s/%s/" % (settings.IMAGES_ROOT, "/".join(str(i) for i in instance.image.name.split('/')[3:-1])) filename, file_extension = os.path.splitext(instance.image.path) img = Image.open(instance.image.path) resize_image(img, None, 160, 78, base_path, "%s_tn%s" % (filename.split('/')[-1], file_extension)) - resize_image(img, None, 650, 78, base_path, "%s_small%s" % (filename.split('/')[-1], file_extension)) + resize_image(img, None, 600, 78, base_path, "%s_small%s" % (filename.split('/')[-1], file_extension)) class BookSitemap(Sitemap): |