On 3/8/06, Christopher Lenz <[EMAIL PROTECTED]> wrote:
>
> Am 08.03.2006 um 16:20 schrieb Joseph Kocherhans:
>
> So how is a Form connected to a Model?

This is the coolest part I think. Unfortunately I buried it with a
bunch of other stuff. The AddForm and ChangeForm would be created
automatically, just like the default Manager. You can override them in
the same fashion. See
http://code.djangoproject.com/wiki/RemovingTheMagic#YoucanoverridedefaultQuerySets
for how Manager overrides work.

class ArticleChangeForm(Form):
   # author will be displayed, but not editable
   readonly_fields = ('author',)

class Article(models.Models):
   name = models.CharField(maxlength=100)
   body = models.TextField()
   author = models.AuthorField()

   class Meta:
       # this gets used in generic create views. It overrides the
default AddForm.
       add_form = ArticleAddForm

   class Admin:
       # this gets used in the admin system. It overrides the default
ChangeForm.
       change_form = ArticleChangeForm

> > Also, there are things that I've probably overlooked. What are they?
>
> I've probably missed some of the previous discussion, but does all
> this mean that Manipulators would go away completely?

There has been confusion regarding that. Adrian has said that
*automatic* maipulators would go away, which I interpret to mean
"don't use manipulators unless you are doing a custom form, i.e.
changing the manipulator's fields attribute" I may be misinterpreting
though.

What I am proposing here is that manipulators go away entirely. Their
functionality would be replaced by forms.

Joseph

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to