On Wed, 2008-04-02 at 17:06 -0700, msaelices wrote:
> This mail maybe can be splitted in two, but I write only one because
> both are related.
> 
> Ok, ModelForms is a very very wonderful thing, but I want to talk
> about (maybe) excessive implicitness.
> 
> Look at this form declaration:
> 
> class AuthorForm(forms.Form):
>     name = myforms.MyCharField(max_length=100)
>     email = myforms.MyEmailField()
> 
> What is the first you find out? Ok, it's a forms with two fields.
> 
> Now look at this:
> 
> class AuthorForm(forms.ModelForm):
>     name = myforms.MyCharField(max_length=100)
>     email = myforms.MyEmailField()
> 
>     class Meta:
>         model = Author
> 
> Now, what do you see? You first think again in a form with two fields,

Not really. I first notice it's a ModelForm subclass because I start
reading from the first line, not the second one. I remember that a
ModelForm class means the fields are initially derived from the model.
The same as "class Foo(Bar):..." tells me that there's behaviour coming
from the Bar class and the Foo class doesn't tell me everything.

> however maybe is a form with five fields. What is happening? You
> explicity define two fields, and the real action is a _redefinition_
> of two fields.

Yes, just as with every other case of subclassing.

> 
> Django philosophy talk about "Explicit better than implicit", but in
> this point ModelForms is not very intuitive.

You're really arguing against Python (and most other languages')
subclassing behaviour. I don't find that particularly supportable.

IT sounds like you want a big sign that says "this isn't a normal Form".
We have that sign... it's spelt "ModelForm". A different type of sign
would be somewhat repetitive and non-Python at this point.

If you have an alternative proposal, pitch it, but your arguments so far
are really saying "I don't like Python's subclassing", so it's a bit
hard to go further on generalisations.

Regards,
Malcolm

-- 
Tolkien is hobbit-forming. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
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