Hi, I have a tiny class called NewElement which only has one field (as below) I don't want to use another form to populate a field that only has one optional field ( especially since you seem to need two submit buttons?) Anyway it all works fine except that if you add the extra element (field) it does not update in the template is there some way to force the queryset to update my element_type manytomany field?
here are my models class NewElement(models.Model): type=models.SlugField(primary_key=True) class A(models.Model): .... some stuff .... new_element=models.ManyToManyField('NewElement',related_name="A") this is in views,py class AForm(ModelForm): new_element=forms.SlugField(required=False) def __init__(self,*args,**kwargs): super(SequenceForm,self).__init__(*args,**kwargs) self.fields['element_types'].queryset= \ NewElement.objects.filter(a__in=self.job.sequence.all()).distinct() class Meta: model=A def edit_A(request): if request.method=="POST": if form.is_valid(): a=form.save new_element=NewElement(form.cleaned_data['new_element'] new_element.save() else ....... thanks --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---