I did run across that post, at it does give some valuable
information.  However, I am still having a little bit of an issue
figuring out how to handle the instance creation.

The biggest thing is that I am using generic views and I am passing a
large queryset Site.objects.all() and the generic view is taking care
of pagination etc to reduce the queryset the a manageable size.  Is it
possible for the view to call a model method to create the form
instance.

Maybe I am making this way to complicated....

Steve


On Mar 3, 9:04 pm, Michael <[EMAIL PROTECTED]> wrote:
> This blog post recently really helped me out with figuring this 
> out:http://collingrady.com/2008/02/18/editing-multiple-objects-in-django-...
>
> It actually is amazingly simple once you get what is going on.
>
> On Mon, Mar 3, 2008 at 5:23 PM, Steve Potter <[EMAIL PROTECTED]> wrote:
>
> >  I am in the process of building a replacement admin change_list for
> >  one of my models.  My goal is to allow some of the more common fields
> >  to be edited on the change_list page as opposed to having to click on
> >  each individual to make changes.
>
> >  So, I have a basic model:
>
> >  class Site(models.Model):
> >         name = models.CharField(max_length=100)
> >         url = models.URLField(null=True, blank=True)
> >         category = models.ForeignKey(Category, null=True, blank=True)
> >         notes = models.TextField(null=True, blank=True)
>
> >  and I have created a basic form with the fields I would like to be
> >  able to edit on the change_list page:
>
> >  class SiteChangeListForm(ModelForm):
> >       class Meta:
> >           model = Site
> >           fields = ('category', 'notes')
>
> >  so I know that I can create an instance with the appropriate default
> >  values by doing something like this:
> >  siteobject = Site.objects.get(pk=1)
> >  form = SiteChangeListForm(instance=siteobject)
>
> >  Then I could include that instance in my context.
>
> >  However, I am using the object_list generic view and I would like a
> >  form instance with appropriately populated for each object.  So I can
> >  do something like this:
>
> >  {{ for site in object_list }}
>
> >     <div>Category: {{ site.form.category }}</div>
> >     <div>Notes: {{ site.form.category }}</div>
>
> >  {{ endfor }}
>
> >  I guess I am just at a loss as to how I would create the appropriate
> >  instances of the form and make them available in the context.  Any
> >  help would be appreciated.
>
> >  Thanks,
>
> >  Steve
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to