Commits

David Bennett committed d579d11

Get rid of SubFieldsetsAdmin… didn't really make sense.

  • Participants
  • Parent commits 2f51954

Comments (0)

Files changed (1)

File user_extension/admin.py

-from django.contrib import admin
 from django.contrib.auth.admin import UserAdmin, UserChangeForm
 from django.forms.models import ModelForm
 
 
-class SubFieldsetsAdmin(admin.ModelAdmin):
-    sub_fieldsets = None
-    sub_add_fieldsets = None
-
-    def __init__(self, model, admin_site):
-        if self.sub_fieldsets is not None:
-            self.fieldsets = self.merge_fieldsets(
-                self.fieldsets or (), self.sub_fieldsets)
-        if self.sub_add_fieldsets is not None:
-            self.add_fieldsets = self.merge_fieldsets(
-                self.add_fieldsets or (), self.sub_add_fieldsets)
-        super(SubFieldsetsAdmin, self).__init__(model, admin_site)
-
-    def merge_fieldsets(self, fieldsets, sub_fieldsets):
-        if isinstance(sub_fieldsets, dict):
-            for k, v in sub_fieldsets.items():
-                fieldsets = fieldsets[0:k] + v + fieldsets[k:]
-            return tuple(fieldsets)
-        return fieldsets + sub_fieldsets
-
-
-class SubUserAdmin(SubFieldsetsAdmin, UserAdmin):
+class SubUserAdmin(UserAdmin):
     """
     A modified UserAdmin that does a switcheroo on the UserChangeForm so
     that admin validation will pass. Otherwise it will choke on any