Format code using black
This commit is contained in:
parent
2ad0c8dbc7
commit
59136050fb
14 changed files with 809 additions and 413 deletions
|
|
@ -5,40 +5,51 @@ from .models import Gallery, Photo, Tag
|
|||
|
||||
|
||||
class GalleryAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'date_start', 'photo_count', 'get_tags')
|
||||
list_filter = ['date_start', 'tags']
|
||||
date_hierarchy = 'date_start'
|
||||
prepopulated_fields = {'slug': ('title',)}
|
||||
list_display = ("title", "date_start", "photo_count", "get_tags")
|
||||
list_filter = ["date_start", "tags"]
|
||||
date_hierarchy = "date_start"
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
model = Gallery
|
||||
exclude = ['photos']
|
||||
autocomplete_fields = ['tags']
|
||||
search_fields = ['title', ]
|
||||
exclude = ["photos"]
|
||||
autocomplete_fields = ["tags"]
|
||||
search_fields = [
|
||||
"title",
|
||||
]
|
||||
|
||||
def get_tags(self, obj):
|
||||
return ", ".join([t.name for t in obj.tags.all()])
|
||||
get_tags.short_description = _('tags')
|
||||
|
||||
get_tags.short_description = _("tags")
|
||||
|
||||
|
||||
class PhotoAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'date_taken', 'date_added',
|
||||
'is_public', 'view_count', 'admin_thumbnail', 'get_owner')
|
||||
list_filter = ['date_added', 'is_public', 'owner']
|
||||
search_fields = ['title', 'slug', 'caption']
|
||||
list_display = (
|
||||
"title",
|
||||
"date_taken",
|
||||
"date_added",
|
||||
"is_public",
|
||||
"view_count",
|
||||
"admin_thumbnail",
|
||||
"get_owner",
|
||||
)
|
||||
list_filter = ["date_added", "is_public", "owner"]
|
||||
search_fields = ["title", "slug", "caption"]
|
||||
list_per_page = 25
|
||||
prepopulated_fields = {'slug': ('title',)}
|
||||
readonly_fields = ('date_taken',)
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
readonly_fields = ("date_taken",)
|
||||
model = Photo
|
||||
|
||||
def get_owner(self, obj):
|
||||
return obj.owner.username
|
||||
get_owner.admin_order_field = 'owner'
|
||||
get_owner.short_description = _('owner')
|
||||
|
||||
get_owner.admin_order_field = "owner"
|
||||
get_owner.short_description = _("owner")
|
||||
|
||||
|
||||
class TagAdmin(admin.ModelAdmin):
|
||||
list_display = ('name',)
|
||||
search_fields = ('name',)
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
list_display = ("name",)
|
||||
search_fields = ("name",)
|
||||
prepopulated_fields = {"slug": ("name",)}
|
||||
model = Tag
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue