def full_name_display(self, obj): return obj.get_full_name() full_name_display.short_description = _(u'Full name') admin.site.register(User, OneFlowUserAdmin) try: admin.site.unregister(DjangoUser) except: pass if settings.FULL_ADMIN: subject_fields_names = tuple(('subject_' + code) for code, lang in languages) subject_fields_displays = tuple((field + '_display') for field in subject_fields_names) class EmailContentAdmin(django_admin.ModelAdmin): list_display = ('name', ) + subject_fields_displays search_fields = ('name', ) + subject_fields_names ordering = ('name', ) save_as = True for attr, attr_name in zip(subject_fields_names, subject_fields_displays): setattr(EmailContentAdmin, attr_name, truncate_field(EmailContent, attr)) admin.site.register(EmailContent, EmailContentAdmin)
change_list_template = "admin/change_list_filter_sidebar.html" change_list_filter_template = "admin/filter_listing.html" def register_language_display(self, obj): return obj.register_data.get('language', u'—').split(',', 1)[0] register_language_display.short_description = _(u'language') admin.site.register(LandingUser, LandingUserAdmin) if settings.FULL_ADMIN: content_fields_names = tuple(('content_' + code) for code, lang in languages) content_fields_displays = tuple((field + '_display') for field in content_fields_names) class LandingContentAdmin(django_admin.ModelAdmin): list_display = ('name', ) + content_fields_displays search_fields = ('name', ) + content_fields_names ordering = ('name', ) #change_list_template = "admin/change_list_filter_sidebar.html" #change_list_filter_template = "admin/filter_listing.html" for attr, attr_name in zip(content_fields_names, content_fields_displays): setattr(LandingContentAdmin, attr_name, truncate_field(LandingContent, attr)) admin.site.register(LandingContent, LandingContentAdmin)
'fields': ( 'name_nt', 'content_nt', ) }), (_(u'Contents (English)'), { 'fields': ( 'name_en', 'content_en', ) }), (_(u'Contents (French)'), { 'fields': ( 'name_fr', 'content_fr', ) }), ) for attr, attr_name in zip(name_fields_names, name_fields_displays): setattr(HelpContentAdmin, attr_name, truncate_field(HelpContent, attr)) for attr, attr_name in zip(content_fields_names, content_fields_displays): setattr(HelpContentAdmin, attr_name, truncate_field(HelpContent, attr)) admin.site.register(HelpContent, HelpContentAdmin)