from django.contrib import admin from gallery.models import Album, City, Location # Register your models here. 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 class AlbumAdmin(admin.ModelAdmin): prepopulated_fields = {'slug': ('name',)} list_display = ('__str__',) search_fields = ('name',) ordering = ('name',) list_per_page = 30 admin.site.register(City, CityAdmin) admin.site.register(Location, LocationAdmin) admin.site.register(Album, AlbumAdmin)