Commits

Anonymous committed 682b383

some admin cleanup

  • Participants
  • Parent commits 83d0a57

Comments (0)

Files changed (2)

File helptext/admin.py

 from .models import FieldHelp
 
 class FieldHelpAdmin(admin.ModelAdmin):
-    pass
+    fields=('field_name', 'help_text')
+    list_display=('app_title', 'model_title', 'field_title', 'help_text')
+    list_display_links=('field_title',)
+    list_filter=('content_type',)
+    search_fields=('field_name', 'help_text')
+                
 
 admin.site.register(FieldHelp, FieldHelpAdmin)

File helptext/models.py

     def field(self):
         return self.model._meta.get_field(self.field_name)
 
+
+    def app_title(self):
+        return self.model._meta.app_label.title()
+    app_title.short_description='Application'
+
+
+    def model_title(self):
+        return self.model._meta.verbose_name.title()
+    model_title.short_description='Model'
+
+
+    def field_title(self):
+        return self.field.verbose_name.title()
+    field_title.short_description='Field'
+
     class Meta:
         ordering=('content_type', 'field_name')
         unique_together=(('content_type', 'field_name'),)