Issue with ManyToMany Relations

2019-03-01 Thread Julio Cojom
I'm writting 2 models with ManyToMany Relations, first I make a model to list all my requirements class Requirements(models.Model): requirement = models.CharField(max_length=150) def __str__(self): return self.requirement So in this example my list of requirements will be: - Person

How to get multiple entries for ManyToMany relations in filter_horizontal Admin

2018-07-24 Thread Christian Merlau
Hey, I am trying to solve following problem and I got stuck. Any help is appreciated... I have two models which represent a product and its parts. class Product(models.Model): name = models.CharField(max_length=200) average_daily = models.FloatField(default=0) average_monthly = models.Inte

Re: all data of all manyToMany relations lost!

2011-05-13 Thread ?manu*
> Dear experts, > > today I was inspecting the ManyToMany relations in the _meta subclass > of a Model class of my database. At some time I realized that all data > associated to such relations was lost in the database! The > corresponding tables are empty. Other fields and relat

all data of all manyToMany relations lost!

2011-05-13 Thread ?manu*
Dear experts, today I was inspecting the ManyToMany relations in the _meta subclass of a Model class of my database. At some time I realized that all data associated to such relations was lost in the database! The corresponding tables are empty. Other fields and relations are ok. I suspect I

Re: Efficient updates on ManyToMany Relations

2010-10-18 Thread brix
With update I also meant adding a new author to the publications in the queryset. This (http://docs.djangoproject.com/en/dev/topics/db/ queries/#updating-multiple-objects-at-once) shows only how to update usual fields, but no m2m Relations as I understand it. I want to add objects. For publications

Re: Efficient updates on ManyToMany Relations

2010-10-18 Thread Marc Aymerich
On Mon, Oct 18, 2010 at 8:49 PM, Marc Aymerich wrote: > > > On Mon, Oct 18, 2010 at 6:31 PM, brix wrote: > >> Hello. >> >> Assume I have publications and authors. Like here: >> http://www.djangoproject.com/documentation/models/many_to_many/ >> >> Now I want to add authors to more than just one p

Re: Efficient updates on ManyToMany Relations

2010-10-18 Thread Marc Aymerich
On Mon, Oct 18, 2010 at 6:31 PM, brix wrote: > Hello. > > Assume I have publications and authors. Like here: > http://www.djangoproject.com/documentation/models/many_to_many/ > > Now I want to add authors to more than just one publication. Lets say > 1000 or more publications. > > Is there a more

Efficient updates on ManyToMany Relations

2010-10-18 Thread brix
Hello. Assume I have publications and authors. Like here: http://www.djangoproject.com/documentation/models/many_to_many/ Now I want to add authors to more than just one publication. Lets say 1000 or more publications. Is there a more efficient way of adding the authors once for each publication

Re: How to insert a tuple into ManyToMany Relations

2010-05-19 Thread Daniel Roseman
On May 19, 5:03 am, Daemoneye wrote: > > class People(forms.Form): > HoldComments=models.ManyToManyField('Comment') > class Comment(forms.Form): > CommentWord=models.CharField(max_length=1) > > I've had these two tables, I'd want the people make a comment so I new > p=comment

How to insert a tuple into ManyToMany Relations

2010-05-18 Thread Daemoneye
class People(forms.Form): HoldComments=models.ManyToManyField('Comment') class Comment(forms.Form): CommentWord=models.CharField(max_length=1) I've had these two tables, I'd want the people make a comment so I new p=comment(CommentWord=Comment)in the view but how can I sav

Re: manytomany relations

2010-01-29 Thread CCC
I mean the users who have the number of group is the lagest ten. and the relation is manytomany.thanks On 1月29日, 下午8时05分, Stodge wrote: > I think he needs to read the tutorial: > > http://docs.djangoproject.com/en/1.1/intro/tutorial03/#write-views-th... > > And I quote: > > "Here's one stab at th

Re: manytomany relations

2010-01-29 Thread CCC
I mean the users who have the number of group is the largest ten and you see the relation is manytomany. On 1月29日, 下午8时05分, Stodge wrote: > I think he needs to read the tutorial: > > http://docs.djangoproject.com/en/1.1/intro/tutorial03/#write-views-th... > > And I quote: > > "Here's one stab at

Re: manytomany relations

2010-01-29 Thread Stodge
I think he needs to read the tutorial: http://docs.djangoproject.com/en/1.1/intro/tutorial03/#write-views-that-actually-do-something And I quote: "Here's one stab at the index() view, which displays the latest 5 poll questions in the system" On Jan 29, 4:57 am, Wayne Koorts wrote: > What d

Re: manytomany relations

2010-01-29 Thread Wayne Koorts
What do you mean by "top ten"? On 29/01/2010, at 20:53, CCC wrote: hi, I have two models:user,group,and they are manytomany, class User(model.Model): name = models.CharField(max_length=20) class Group(models.Model): name = models.CharField(max_length=20) users = models.ManytoMany

manytomany relations

2010-01-28 Thread CCC
hi, I have two models:user,group,and they are manytomany, class User(model.Model): name = models.CharField(max_length=20) class Group(models.Model): name = models.CharField(max_length=20) users = models.ManytoManyField(User) now i want to get the top ten users who have the groups

Re: how to get ManyToMany relations?

2009-12-27 Thread akaariai
> model = CarModel.objects.filter(pk = modelId) > for m in model.modelTypes.all(): >         data = data+m.description+'|' Your problem is that objects.filter(pk=modelId) gives you a list of one element. You need to use either objects.get(pk=modelId) or objects.filter(pk=modelId)[0]. -- You rec

Re: how to get ManyToMany relations?

2009-12-27 Thread Michael Jenkinson
dels(model) } class model { list of features } cheers michael - Original Message From: Benjamin W. To: Django users Sent: Sun, December 27, 2009 4:37:51 PM Subject: how to get ManyToMany relations? Hi there, I've problems to access manyToMany relartions. I got the followin

[Fwd: Re: how to get ManyToMany relations?]

2009-12-27 Thread Steve Holden
Benjamin W. wrote: > Hi there, > > I've problems to access manyToMany relartions. > I got the following model: > > class ModelType(models.Model): > description = models.CharField(max_length=100) > def __unicode__(self): > return u"%s" % (self.description) > > class CarM

how to get ManyToMany relations?

2009-12-27 Thread Benjamin W.
Hi there, I've problems to access manyToMany relartions. I got the following model: class ModelType(models.Model): description = models.CharField(max_length=100) def __unicode__(self): return u"%s" % (self.description) class CarModel(models.Model): descrip

Re: Multiple ManyToMany relations with the same class

2008-10-07 Thread Ariel Mauricio Nunez Gomez
Por cierto, cuando ya este la base de datos llena de actuaciones nos invitas a escuchar a los samberos. Ariel. On Tue, Oct 7, 2008 at 12:05 PM, Pablo Catalina <[EMAIL PROTECTED]>wrote: > # python manage.py validate > Error: One or more models did not validate: > concerts.concert: Accessor for m

Re: Multiple ManyToMany relations with the same class

2008-10-07 Thread Pablo Catalina
# python manage.py validate Error: One or more models did not validate: concerts.concert: Accessor for m2m field 'musicans' clashes with related m2m field 'person.concert_set'. Add a related_name argument to the definition for 'musicans'. concerts.concert: Accessor for m2m field 'coches' clashes wi

Re: Multiple ManyToMany relations with the same class

2008-10-06 Thread Malcolm Tredinnick
On Mon, 2008-10-06 at 13:52 -0700, xkill wrote: > Hello, > > I tried to add multiple manytomany fields to a class, that pointing to > the same class. > > For example: > > class person(models.Model): > name = models.CharField(max_length=30) > phone = models.CharField(max_length=9, blank

Re: Multiple ManyToMany relations with the same class

2008-10-06 Thread James Bennett
On Mon, Oct 6, 2008 at 3:52 PM, xkill <[EMAIL PROTECTED]> wrote: > But it doesn't work, how can I do it? The error message you will receive will tell you what to do. -- "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~-~--~~~---~-

Multiple ManyToMany relations with the same class

2008-10-06 Thread xkill
Hello, I tried to add multiple manytomany fields to a class, that pointing to the same class. For example: class person(models.Model): name = models.CharField(max_length=30) phone = models.CharField(max_length=9, blank=True, null=True) def __unicode__(self): return self.name

Re: Displaying ManyToMany relations in Admin

2008-09-19 Thread Simon Willison
On Sep 19, 10:24 am, "Nick Sandford" <[EMAIL PROTECTED]> wrote: > Is there some kind of limit the admin imposes on the number of items > it will show in a or the horizontal filter list? If so, can I > change it? Also, is there any better way to do this? raw_id_fields is the admin option you need

Displaying ManyToMany relations in Admin

2008-09-19 Thread Nick Sandford
Hi all, I currently have a site setup to manage students, teachers and classrooms. In the classroom admin interface I have a horizontal filter to select the students and teachers in a classroom. The only problem is, I have roughly 1400 students and 400 teachers to select from. From what I can see

Re: indirect ManyToMany relations between models

2006-08-05 Thread Malcolm Tredinnick
On Sat, 2006-08-05 at 19:37 +0200, [EMAIL PROTECTED] wrote: [...] > I want to select now all objects of InfoType for Company belonging indirectly > together by MetaObject. > > I have implemented this into Company: > > class Company(models.Model): > ... > def infotypes(self): >

indirect ManyToMany relations between models

2006-08-05 Thread dummy
Hi all, I have the following 3 Models: class Company(models.Model): name = models.CharField(maxlength=40) class InfoType(models.Model): type = models.CharField(maxlength=40) class MetaObject(models.Model): company = models.ManyToManyField(Company, null=True, blank=True)

ManyToMany relations and order_with_respect_to

2006-03-03 Thread akaihola
In my model I have Papers and Persons. One Paper usually has multiple Persons as authors, and they have to be in a determined order. Every Person can of course be author for multiple Papers. On top of all, I'd like to be able to edit authors inline and re-arrange their order for every Paper in ad