Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » ModelForm with ManyToManyField on the other side [RSS Feed]

#1 June 21, 2010 19:51:35

Skylar S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

ModelForm with ManyToManyField on the other side


class Material(models.Model):

products = ManyToManyField('Product', related_name='materials')

class Products(models.Model):

...

class ProductForm(forms.ModelForm):

class Meta:
model = Product
fields = ('materials', )

I want to do this.

I saw this discussion:http://groups.google.com/group/django-users/browse_thread/thread/49213bf57a6a3033/cceb6912ad43fca0?show_docid=cceb6912ad43fca0&pli=1And, I tried this snippet:http://djangosnippets.org/snippets/1295/The related names of this snippet make no sense. If they are made to
make sense, then there would be an accessor clash. Without the class,
the accessors are redundant at best...

Has any progress been made on this convenience or is the recommended
course just to create a non-Model form and make a save method?

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » ModelForm with ManyToManyField on the other side [RSS Feed]

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support