Friday, October 1, 2010

Quirky tabular display for customized inline models?

I have a field which I need to reference in an override of the save() function (as part of the class MyModelInlineForm(forms.ModelForm)). 

However, I don't want that same field to appear in the inline tabular display.  In the __init__ for form class, I have this:

def __init__(self, *args, **kwargs):
    ...
    self.fields['eggs'].required = False
    self.fields['eggs'].widget.attrs['disabled'] = 'disabled'

The 'eggs' field subsequently does not appear in the listing.  However, while the field title does not appear in the header row (nor there is there a <td></td> for it), there is an extra blank column in the data rows (i.e a extra blank <td></td>).  This looks a little odd as the rows/headers do not match up.

How can I alter the template so it does not show up... and, is this behavior expected, or is it a quirk in the design?

Thanks
Derek

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment