@register.simple_tag(takes_context=True)
def post_process_fieldsets(context, fieldset):
 if fieldset.model_admin.fieldsets:
  return fieldset
 fields_to_include = set(fieldset.form.fields.keys())
 for f in (u'id', u'DELETE', u'ORDER'):
  fields_to_include.discard(f)
 def _filter_recursive(fields):
  ret = []
  for f in fields:
   if isinstance(f, (list, tuple)):
    sub = _filter_recursive(f)
    if sub:
     ret.append(sub)
   elif (f in fields_to_include):
    ret.append(f)
    fields_to_include.discard(f)
  return ret
 new_fields = _filter_recursive(fieldset.fields)
 for f in fields_to_include:
  new_fields.append(f)
 if context.get(u'request'):
  new_fields.extend(list(fieldset.model_admin.get_readonly_fields(context.get(u'request'), context.get(u'original'))))
 fieldset.fields = new_fields
 return u''

@ register . simple_tag ( takes_context = True ) def post_process_fieldsets ( context , fieldset ) : if fieldset . model_admin . fieldsets : return fieldset fields_to_include = set ( fieldset . form . fields . keys ( ) ) for f in ( u'id' , u'DELETE' , u'ORDER' ) : fields_to_include . discard ( f ) def _filter_recursive ( fields ) : ret = [ ] for f in fields : if isinstance ( f , ( list , tuple ) ) : sub = _filter_recursive ( f ) if sub : ret . append ( sub ) elif ( f in fields_to_include ) : ret . append ( f ) fields_to_include . discard ( f ) return ret new_fields = _filter_recursive ( fieldset . fields ) for f in fields_to_include : new_fields . append ( f ) if context . get ( u'request' ) : new_fields . extend ( list ( fieldset . model_admin . get_readonly_fields ( context . get ( u'request' ) , context . get ( u'original' ) ) ) ) fieldset . fields = new_fields return u''
removes a few fields from feincms admin inlines .