On Thu, 2009-01-08 at 18:43 -0800, adrian wrote:
> 
> What would be the best way to do it so when django updates
> I don't have to rewrite my extension?   So that it might be reusable
> by others?   Should I
> checkout a version or can I use the 1.0.2 I have?

You should be able to write your class without modifying Django's code
at all. It would be completely independent.

I'm thinking you would end up with something like this in your code:

        class SomeForm(MyModelForm):
            fieldsets = [...]
        
            class Meta:
                # ...
        
where MyModelForm is a subclass of forms.ModelForm containing, perhaps,
some code like django.contrib.admin.helpers.InlineAdminForm, or
something similar.

> 
> Don't know if I have the depth of understanding of django to do this
> well, but I'm willing to try.
> I would try to use the same fieldset syntax as is used in admin.py,
> but it would be put in the
> the Meta of the ModelForm.

Initially, I would just make it an attribute, say, on a subclass of
ModelForm. Simply to avoid having to mess around with the metaclassing
infrastructure (although that might be unavoidable).

Really, though, the idea is to solve your problem. If you want to roll
up your sleeves and work out the subclassing solution based on
InlineAdminForm, do that. Or you could override
django.forms.forms.BaseForm._html_output() in your subclass to work with
fieldsets for your forms. Or you could do the organisation in your
template.

Depends on how much time you have available to invest in this and your
skill and comfort level. All that being said, a healthy dose of
persistence and stubborness usually manages to get any problem solved
pretty well. You just have to be prepared not to let the code win. ;-)

Best wishes,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to