Add Photo model & templates
This commit is contained in:
parent
9a483b2a7f
commit
f04beb3aaa
9 changed files with 123 additions and 11 deletions
|
@ -1,8 +1,7 @@
|
|||
from django.contrib import admin
|
||||
from imagekit.admin import AdminThumbnail
|
||||
|
||||
from gallery.models import Album, City, Location
|
||||
|
||||
# Register your models here.
|
||||
from gallery.models import Album, City, Location, Photo
|
||||
|
||||
|
||||
class CityAdmin(admin.ModelAdmin):
|
||||
|
@ -19,6 +18,7 @@ class LocationAdmin(admin.ModelAdmin):
|
|||
search_fields = ('place', 'city__name',)
|
||||
list_per_page = 30
|
||||
|
||||
|
||||
class AlbumAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
list_display = ('__str__',)
|
||||
|
@ -27,7 +27,15 @@ class AlbumAdmin(admin.ModelAdmin):
|
|||
list_per_page = 30
|
||||
|
||||
|
||||
class PhotoAdmin(admin.ModelAdmin):
|
||||
list_display = ('__str__', 'album', 'admin_thumbnail',)
|
||||
list_display_links = ('__str__',)
|
||||
list_editable = ('album',)
|
||||
readonly_fields = ['slug', 'taken_at', 'height', 'width', 'exif', ]
|
||||
admin_thumbnail = AdminThumbnail(image_field='photo_thumbnail',)
|
||||
|
||||
|
||||
admin.site.register(City, CityAdmin)
|
||||
admin.site.register(Location, LocationAdmin)
|
||||
admin.site.register(Album, AlbumAdmin)
|
||||
|
||||
admin.site.register(Photo, PhotoAdmin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue