new fields: gallery, time/place for events
[django-migdal.git] / migdal / admin.py
index 6d4bffe..cf1c514 100644 (file)
@@ -18,7 +18,7 @@ class AttachmentInline(admin.TabularInline):
 
 def filtered_entry_admin(typ):
     class EntryAdmin(admin.ModelAdmin):
-        def queryset(self, request):
+        def get_queryset(self, request):
             return self.model.objects.filter(type=typ.db)
 
         def has_add_permission(self, request):
@@ -37,15 +37,16 @@ def filtered_entry_admin(typ):
             return field
 
         date_hierarchy = 'date'
-        readonly_fields = ('date', 'changed_at', 'first_published_at') + \
-            translated_fields(('published_at',))
+        readonly_fields = ('date', 'changed_at') + translated_fields(('published_at',))
+        if app_settings.PUBLISH_DATE_EDITABLE:
+            readonly_fields += ('first_published_at',)
         _promo_if_necessary = ('promo',) if typ.promotable else ()
 
         fieldsets = (
             (None, {
                 'fields': _promo_if_necessary + (
                     'in_stream', 'author', 'author_email', 'canonical_url', 'image',
-                    'date', 'first_published_at', 'changed_at')
+                    'date', 'first_published_at', 'changed_at', 'gallery')
                 }),
         ) + tuple(
             (ln, {'fields': (
@@ -55,6 +56,8 @@ def filtered_entry_admin(typ):
                 'slug_%s' % lc,
                 'lead_%s' % lc,
                 'body_%s' % lc,
+                'place_%s' % lc,
+                'time_%s' % lc,
                 )})
             for lc, ln in app_settings.OBLIGATORY_LANGUAGES
         ) + tuple(
@@ -65,6 +68,8 @@ def filtered_entry_admin(typ):
                 'slug_%s' % lc,
                 'lead_%s' % lc,
                 'body_%s' % lc,
+                'place_%s' % lc,
+                'time_%s' % lc,
                 )})
             for lc, ln in app_settings.OPTIONAL_LANGUAGES
         )