Commits

Brad Montgomery committed dc99a68

added app/model properties to FieldSanitizers, and listed them in the ModelAdmin

  • Participants
  • Parent commits 01337e4

Comments (0)

Files changed (2)

 from models import FieldSanitizer
 
 class FieldSanitizerAdmin(admin.ModelAdmin):
-    list_display = ('content_type', 'field_name', ) 
+    list_display = ('content_type', 'app_name', 'model_name', 'field_name', ) 
     form = FieldSanitizerAdminForm
 admin.site.register(FieldSanitizer, FieldSanitizerAdmin)

janitor/models.py

         ordering = ['content_type', 'field_name', ]
         unique_together = (('content_type', 'field_name'), )
 
+    @property
+    def app_name(self):
+        """ return the name of the App to which this sanitizer is associated """
+        return self.content_type.app_label
+    
+    @property
+    def model_name(self):
+        """ return the name of the Model to which this sanitizer is associated """
+        return self.content_type.model
+
     def save(self, *args, **kwargs):
         """
         Checks to see that ``field_name`` is an attribute of the selected Model,