35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
''' Classes and modules for the administrative backend. '''
|
|
|
|
from django.contrib import admin
|
|
from django.contrib.auth import get_user_model
|
|
from django.contrib.auth.admin import UserAdmin
|
|
from lostplaces.models import *
|
|
|
|
from lostplaces.forms import ExplorerCreationForm, ExplorerChangeForm
|
|
|
|
# Register your models here.
|
|
|
|
class VoucherAdmin(admin.ModelAdmin):
|
|
fields = ['code', 'expires_when', 'created_when']
|
|
readonly_fields = ['created_when']
|
|
list_display = ('__str__', 'code', 'created_when', 'expires_when')
|
|
# todo: is_valid (Wurstwasser)
|
|
|
|
class PhotoAlbumsAdmin(admin.ModelAdmin):
|
|
list_display = ('label', 'place', 'url' )
|
|
|
|
class PlacesAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'submitted_by', 'submitted_when')
|
|
|
|
class PlaceImagesAdmin(admin.ModelAdmin):
|
|
list_display = ('__str__', 'place', 'submitted_by')
|
|
|
|
admin.site.register(Explorer)
|
|
admin.site.register(Voucher, VoucherAdmin)
|
|
admin.site.register(Place, PlacesAdmin)
|
|
admin.site.register(PlaceImage, PlaceImagesAdmin)
|
|
admin.site.register(PhotoAlbum, PhotoAlbumsAdmin)
|