multi-object form, objects all of same class

2013-06-19 Thread Radomir Wojcik
So I have been looking at different examples using multi-object forms where you bring in objects of different classes. I also looked at formsets but I don't think these fit what I want to do. class Alarm(models.Model): location = models.ForeignKey(Location, related_name='alarms') owners

Re: Multi object form

2012-04-24 Thread Marcin Tustin
There is documentation on the various options. It is possible to specify no extras. On Tue, Apr 24, 2012 at 15:09, David wrote: > Hi > > That is brilliant thank you! I've been struggling with this for too long :( > > MyModel Set = modelformset_factory(MyModel) > formset = MyModelFormSet(

Re: Multi object form

2012-04-24 Thread David
Adding ,extra=0 to the modelformset_factory() line appears to do the job. Thanks for your help guys -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/aJyLcUk

Re: Multi object form

2012-04-24 Thread David
Hi That is brilliant thank you! I've been struggling with this for too long :( MyModel Set = modelformset_factory(MyModel) formset = MyModelFormSet(queryset= MyModel.objects.select_related().filter(left_team__isnull=True).filter(team=pk)) variables = RequestContext(request, {

Re: Multi object form

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 3:02 PM, David wrote: >  Thank you both for your replies. > > Having created a modelform and used: > > ArticleFormSet = formset_factory(ArticleForm, extra=2) > > I have a queryset that produces the objects I want to edit in my formset. > How can I bind these objects to the

Re: Multi object form

2012-04-24 Thread David
Thank you both for your replies. Having created a modelform and used: ArticleFormSet = formset_factory(ArticleForm, extra=2) I have a queryset that produces the objects I want to edit in my formset. How can I bind these objects to the formset and therefore remove the need for the extra=2 para

Re: Multi object form

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 2:47 PM, David wrote: > Hello > > I need to produce a form that will contain a series of rows. Each row will > be a specific object. Columns for each row will have data that will need > editting. > > ie: > > Person1  EditA  EditB  EditC > Person2  EditA  EditB  EditC > Pers

Re: Multi object form

2012-04-24 Thread Marcin Tustin
Create a modelform, then use a formset to manage all of the modelforms. On Tue, Apr 24, 2012 at 14:47, David wrote: > Hello > > I need to produce a form that will contain a series of rows. Each row will > be a specific object. Columns for each row will have data that will need > editting. > > ie:

Multi object form

2012-04-24 Thread David
Hello I need to produce a form that will contain a series of rows. Each row will be a specific object. Columns for each row will have data that will need editting. ie: Person1 EditA EditB EditC Person2 EditA EditB EditC Person3 EditA EditB EditC Person4 EditA EditB EditC The form