Permalink
Browse files

modeladmin fieldsets to populate fields

  • Loading branch information...
1 parent 38b4c2a commit b1c449fa694cb62949056409e61af3c8dbfcf656 @zbyte64 committed Jan 17, 2013
Showing with 8 additions and 1 deletion.
  1. +1 −0 docs/source/manual/resources/models.rst
  2. +7 −1 hyperadmin/sites.py
@@ -33,6 +33,7 @@ ModelResource options
* model
* fields
+* fieldsets (flattened to provide fields)
* exclude
* paginator
* list_display
View
@@ -171,9 +171,15 @@ def get_actions(self, request):
def generate_model_resource_from_admin_model(self, admin_model):
from hyperadmin.resources.models import ModelResource
from django import forms
+ if admin_model.fieldsets:
+ mfields = list()
+ for section, params in admin_model.fieldsets:
+ mfields.extend(params['fields'])
+ else:
+ mfields = admin_model.fields
class GeneratedModelResource(ModelResource):
#raw_id_fields = ()
- fields = admin_model.fields
+ fields = mfields
exclude = admin_model.exclude
#fieldsets = None
#filter_vertical = ()

0 comments on commit b1c449f

Please sign in to comment.