Show owner in photo admin list
This commit is contained in:
parent
b806c4579b
commit
7598c47621
2 changed files with 13 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from photologue.admin import GalleryAdmin as GalleryAdminDefault
|
from photologue.admin import GalleryAdmin as GalleryAdminDefault
|
||||||
from photologue.admin import PhotoAdmin as PhotoAdminDefault
|
from photologue.admin import PhotoAdmin as PhotoAdminDefault
|
||||||
from photologue.models import Gallery, Photo, PhotoEffect, PhotoSize, Watermark
|
from photologue.models import Gallery, Photo, PhotoEffect, PhotoSize, Watermark
|
||||||
|
|
@ -32,7 +33,16 @@ class PhotoAdmin(PhotoAdminDefault):
|
||||||
model.
|
model.
|
||||||
"""
|
"""
|
||||||
inlines = [PhotoExtendedInline, ]
|
inlines = [PhotoExtendedInline, ]
|
||||||
|
list_display = ('title', 'date_taken', 'date_added',
|
||||||
|
'is_public', 'view_count', 'admin_thumbnail', 'get_owner')
|
||||||
|
list_filter = ['date_added', 'is_public', 'extended__owner']
|
||||||
|
|
||||||
|
def get_owner(self, obj):
|
||||||
|
if not hasattr(obj, 'extended'):
|
||||||
|
return "No owner"
|
||||||
|
return obj.extended.owner.username
|
||||||
|
get_owner.admin_order_field = 'owner'
|
||||||
|
get_owner.short_description = _('owner')
|
||||||
|
|
||||||
admin.site.unregister(Gallery)
|
admin.site.unregister(Gallery)
|
||||||
admin.site.unregister(Photo)
|
admin.site.unregister(Photo)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{% extends "admin/change_list.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{# Hide upload as zip #}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue