2024-12-28 12:21:29 +02:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2024-12-29 23:25:03 +02:00
|
|
|
from gallery.models import Album, City, Location
|
2024-12-29 17:35:10 +02:00
|
|
|
|
2024-12-28 12:21:29 +02:00
|
|
|
# Register your models here.
|
2024-12-29 17:35:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
class CityAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('name',)
|
|
|
|
search_fields = ('name',)
|
|
|
|
ordering = ('name',)
|
|
|
|
list_per_page = 30
|
|
|
|
|
|
|
|
|
|
|
|
class LocationAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('city', 'place')
|
|
|
|
list_filter = ('city',)
|
|
|
|
ordering = ('city__name',)
|
|
|
|
search_fields = ('place', 'city__name',)
|
|
|
|
list_per_page = 30
|
|
|
|
|
2024-12-29 23:25:03 +02:00
|
|
|
class AlbumAdmin(admin.ModelAdmin):
|
|
|
|
prepopulated_fields = {'slug': ('name',)}
|
|
|
|
list_display = ('__str__',)
|
|
|
|
search_fields = ('name',)
|
|
|
|
ordering = ('name',)
|
|
|
|
list_per_page = 30
|
|
|
|
|
2024-12-29 17:35:10 +02:00
|
|
|
|
2024-12-29 23:25:03 +02:00
|
|
|
admin.site.register(City, CityAdmin)
|
2024-12-29 17:35:10 +02:00
|
|
|
admin.site.register(Location, LocationAdmin)
|
2024-12-29 23:25:03 +02:00
|
|
|
admin.site.register(Album, AlbumAdmin)
|
|
|
|
|