-class EntryAdmin(admin.ModelAdmin):
- date_hierarchy = 'date'
- fieldsets = (
- (None, {'fields': (('type', 'promo'), 'author', 'author_email', 'image', 'date')}),
- ) + tuple(
- (ln, {'fields': (
- ('published_%s' % lc),
- 'title_%s' % lc,
- 'slug_%s' % lc,
- 'lead_%s' % lc,
- 'body_%s' % lc,
- )})
- for lc, ln in app_settings.OBLIGATORY_LANGUAGES
- ) + tuple(
- (ln, {'fields': (
- ('needed_%s' % lc, 'published_%s' % lc),
- 'title_%s' % lc,
- 'slug_%s' % lc,
- 'lead_%s' % lc,
- 'body_%s' % lc,
- )})
- for lc, ln in app_settings.OPTIONAL_LANGUAGES
- ) + (
- (_('Categories'), {'fields': ('categories',)}),
- )
- prepopulated_fields = dict([
- ("slug_%s" % lang_code, ("title_%s" % lang_code,))
- for lang_code, lang_name in settings.LANGUAGES
- ])
+def filtered_entry_admin(typ):
+ class EntryAdmin(admin.ModelAdmin):
+ def queryset(self, request):
+ return self.model.objects.filter(type=typ)