from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
-from migdal.models import Entry, Attachment
+from migdal.models import Entry, Attachment, Photo
from migdal import app_settings
from fnpdjango.utils.models import filtered_model
from fnpdjango.utils.models.translation import translated_fields
readonly_fields = ['url']
+class PhotoInline(admin.TabularInline):
+ model = Photo
+ readonly_fields = ['url']
+
+
def filtered_entry_admin(typ):
class EntryAdmin(admin.ModelAdmin):
def get_queryset(self, request):
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
+ 'place_%s' % lc,
+ 'time_%s' % lc,
)})
for lc, ln in app_settings.OBLIGATORY_LANGUAGES
) + tuple(
'slug_%s' % lc,
'lead_%s' % lc,
'body_%s' % lc,
+ 'place_%s' % lc,
+ 'time_%s' % lc,
)})
for lc, ln in app_settings.OPTIONAL_LANGUAGES
)
list_filter = _promo_if_necessary + \
translated_fields(('published',)) + \
translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES)
- inlines = (AttachmentInline,)
+ inlines = (PhotoInline, AttachmentInline)
search_fields = ('title_pl', 'title_en')
return EntryAdmin