I'm a Django newbie, so please pardon me if I am asking stupid
questions or raising issues long-solved,
but ...
I have some requirements similar to these that you are discussing for
'formsets', and maybe my experience can help a little..

I went ahead and built myself a  'formset' factory, of sorts, for my
application,
to meet the following requirements that I couldn't readily handle with
the existing newforms.ModelForm class (at least as re-worked by the
Google Apps team ... maybe the 'standard Django' code handles them
better):

1) forms to display/edit only some of the fields in a model
reasons:
1.1) multiple forms per page,for easier page layout (e.g. multiple
columns)
1.2) multiple edit pages per object - e.g. "wizard" editing
2) display-only fields
reasons:
2.1) display, but not change, 'derived fields', such as 'slugified'
fields, date-updated, etc.
2.2) edits restricted by business logic, such as only allowing a
supervisor to change a selling price in a retail store application

I just took a quick look at your 'formset', at
  [1]: http://dpaste.com/hold/51750/
and I see that it supports (my 1.1) multiple-forms-per-page
I also found:
  http://www.djangosnippets.org/snippets/758/
which supports (my 2) display-only fields.
I like that: will anything like it get into 'base Django'?

I took a brief look at this:
  http://www.djangoproject.com/documentation/form_wizard/
but I didn't like the concept of shuffling all of those hidden fields
back and forth.

If any of my requirements, or concepts, or code, would be of help,
please let me know how I can contribute something

Here's my application:
http://froi.gawsh.net
It does data entry for a Workers Compensation claim, and it gathers
100 to 300 fields through a 'wizard'-style interface.
It's running on the Google App Engine, so it's using Django templates
but, of course, uses the Google datastore.
If you can spare the time, please take a look at it and send me any
comments.

Should I be looking at any other documentation, or code, that you are
developing?

Thanks for any advice you may have,
Gary Davis


On May 27, 4:33 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, May 22, 2008 at 12:06 AM, Joseph Kocherhans
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > On Wed, May 21, 2008 at 8:44 AM, Russell Keith-Magee
> > <[EMAIL PROTECTED]> wrote:
>
> >> However, that said: I might be missing something here, but we've just
> >> gone through the process of deprecating form_for_model and
> >> form_for_instance based upon the reasoning that a class based form
> >> definition is more flexible than trying to shoehorn everything into a
> >> factory method. Is there a reason that we are introducing a new set of
> >> factory methods rather than using a definition analogous to ModelForm?
> >> To that end, isn't modelform_factory an analog of form_for_model?
>
> > Brian and I both tried to come up with a class based syntax to take
> > care of formsets, but everything we came up with felt forced... like
> > we were *just* doing it as an attempt at consistency. Our attempts
> > actually made the implementation worse. This is one of the reasons
> > Brian wrote the email though. If someone wants to propose a class
> > based syntax, please do so. I'd love to see something better, and I
> > have a hunch that there *is* a better way. I've been sitting on it for
> > a few months now, and nothing has come to me. I'm probably too close
> > to the problem though.
>
> I might not be close enough to the problem, but it seems to me that
> you are already 90% of the way there with one of your examples. In the
> sample docs, you have an example of extending a 'BaseFormSet' to add a
> clean method:
>
> class BaseArticleFormSet(BaseFormSet):
>      def clean(self):
>          raise forms.ValidationError, u'An error occured.'
>
> ArticleFormSet = formset_factory(ArticleForm,
> formset=BaseArticleFormSet, extra=2)
>
> Is there any particular reason that you can't just add a Meta class to
> this class definition, in the same way that a ModelForm works:
>
> class ArticleFormSet(FormSet)
>     class Meta:
>         form = ArticleForm
>         extra = 2
>         can_delete = True
>
>     def clean(self):
>         raise forms.ValidationError, u'An error occured.'
>
> I'm guessing InlineFormSet and ModelFormSet will need their own meta
> class processing to handle their specific options, but there should be
> a lot of common code between them.
>
> Yours,
> Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
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