Added VouchersAdmin and PlaceImagesAdmin.

This commit is contained in:
Marcus Scholz 2020-09-18 20:40:58 +02:00
parent c66baaa765
commit e698f3b224

View File

@ -15,6 +15,8 @@ from lostplaces.forms import ExplorerCreationForm, ExplorerChangeForm
class VoucherAdmin(admin.ModelAdmin): class VoucherAdmin(admin.ModelAdmin):
fields = ['code', 'expires_when', 'created_when'] fields = ['code', 'expires_when', 'created_when']
readonly_fields = ['created_when'] readonly_fields = ['created_when']
list_display = ('__str__', 'code', 'created_when', 'expires_when')
# todo: is_valid (Wurstwasser)
class PhotoAlbumsAdmin(admin.ModelAdmin): class PhotoAlbumsAdmin(admin.ModelAdmin):
list_display = ('label', 'place', 'url' ) list_display = ('label', 'place', 'url' )
@ -22,8 +24,11 @@ class PhotoAlbumsAdmin(admin.ModelAdmin):
class PlacesAdmin(admin.ModelAdmin): class PlacesAdmin(admin.ModelAdmin):
list_display = ('name', 'submitted_by', 'submitted_when') list_display = ('name', 'submitted_by', 'submitted_when')
class PlaceImagesAdmin(admin.ModelAdmin):
list_display = ('__str__', 'place', 'submitted_by')
admin.site.register(Explorer) admin.site.register(Explorer)
admin.site.register(Voucher, VoucherAdmin) admin.site.register(Voucher, VoucherAdmin)
admin.site.register(Place, PlacesAdmin) admin.site.register(Place, PlacesAdmin)
admin.site.register(PlaceImage) admin.site.register(PlaceImage, PlaceImagesAdmin)
admin.site.register(PhotoAlbum, PhotoAlbumsAdmin) admin.site.register(PhotoAlbum, PhotoAlbumsAdmin)