Need help with models.ManyToManyField() as it always includes all objects when I click "save and continue editing"

2019-05-14 Thread Onur Seker
Hi, everytime I am selecting only one object from my Product from all my Products available in my Cart. It saves and includes all Products to the model.ManyToManyField(Product) in my Cart model. I dont know what is wrong with my code here. Can somebody help me please? -- You received this me

Re: models.ManyToManyField

2013-04-18 Thread Gabriel
The first solution works like this: If you create a foreign key from ModelA to ModelB, Django automatically create something like B.modela_set that works just like the objects attribute, but just for the A objects that are related to B, right? That's why you can du stuff like attore.film_set.all()

Re: models.ManyToManyField

2013-04-18 Thread Federico Erbea
I think it is the first solution that you have proposed, but I can't figure out how to use it. Also, is there a way to make sure that the ID is automatically taken? With a proper publisher for loop I would like all the lists of movies for each actor. This is my urls.py from django.conf.urls.de

Re: models.ManyToManyField

2013-04-18 Thread Federico Erbea
I think it is the first solution that you have proposed, but I can't figure out how to use it. Also, is there a way to make sure that the ID is automatically taken? With a proper publisher for loop I would like all the lists of movies for each actor. This is my urls.py from django.conf.urls.de

Re: models.ManyToManyField

2013-04-17 Thread Gabriel
Hey, I didn't quite understand what you're trying to do, so I'm covering both interpretations. 1- If you're trying to, for instance, get all the films an actor was in you can, as explained here https://docs.djangoproject.com/en/1.5/topics/db/queries/#many-to-many-relationships(the link is for Dja

models.ManyToManyField

2013-04-17 Thread Federico Erbea
th=1000 ) locandina = models.CharField( max_length=100 ) copertina = models.CharField( max_length=100 ) trailer = models.ForeignKey( Trailer ) data_inserimento = models.DateField( null=True, verbose_name="data d'inserimento" ) anno = models.ForeignKey( Anno )

Re: models.ManyToManyField subclass, problem with getting values by form.

2009-06-28 Thread Vladimir Shulyak
Well... Problem closed. I was trying to override things that I shouldn't. Now I got the idea of returning manager by __get__ and everything is just fine :) On Jun 27, 11:13 pm, Vladimir Shulyak wrote: > Hello, > > I am trying to develop sublcass of models.ManyToManyField. This

models.ManyToManyField subclass, problem with getting values by form.

2009-06-27 Thread Vladimir Shulyak
Hello, I am trying to develop sublcass of models.ManyToManyField. This class should return text representations of objects to forms.TextField (like TagField from django-tagging). The reason to make my own representation is because: - I don't need content types - I need "fron

Re: models.ManyToManyField: Multi-relationship in one table

2007-03-20 Thread hoamon
i persist in models.ManyToManyField so much so that i forgot this method. thank you Ivan. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: models.ManyToManyField: Multi-relationship in one table

2007-03-20 Thread Ivan Sagalaev
hoamon wrote: > Course|Trainee|Company > C1| T1 | Com1 > C1| T2 | Com1 > C1| T3 | Com1 > C2| T1 | Com2 > C2| T3 | Com1 > C2| T4 | Com2 > C3| T1 | Com2 You really can't do it using standard ManyToManyField. The common way is to create this r

models.ManyToManyField: Multi-relationship in one table

2007-03-19 Thread hoamon
to C2,C3. how can i implement this relation in Couse Model, i cann't use the syntax like trainee = models.ManyToManyField(Trainee) company = models.ManyToManyField(Company) that makes two relation tables not one. thank you for your patience. --~--~-~--~~~---~--