1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.contrib import admin
6 from django.utils.translation import ugettext_lazy as _
8 from social.models import Cite
11 class CiteAdmin(admin.ModelAdmin):
12 list_display = ['nonempty_text', 'sticky', 'vip', 'small', 'has_image']
14 (None, {'fields': ('book', 'text', 'small', 'vip', 'link', 'sticky')}),
18 'image', 'image_shift', 'image_title', 'image_author',
19 'image_link', 'image_license', 'image_license_link')},
23 def nonempty_text(self, cite):
26 return "(%s)" % (cite.image_title.strip() or cite.link)
27 nonempty_text.short_description = _('text')
29 def has_image(self, cite):
30 return bool(cite.image)
31 has_image.short_description = _('image')
32 has_image.boolean = True
35 admin.site.register(Cite, CiteAdmin)