Is there a good reason not to do something like the following in
django.db.models.Model?

def form(self):
    return form_for_instance(self)

@classmethod
def form(cls):
    return form_for_model(cls)

As I was writing this, I realized that you can't do this in Python
because you can't overload function names, but surely somebody smarter
than me can figure out a clever way that model_instance.form() and
ModelClass.form() would both do the right thing.

I mention this because I'm noticing that I want to customize forms and
think that the right OO place to do that is probably in the model. Being
able to override a standard function would make the right way to do it
pretty obvious.

I'm also pretty excited about not having another import for
form_for_model and form_for_instance in nearly all my views.py files.

What's more, this is completely backwards compatible!! :-)

Todd


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to