Re: How to retrive data from more than two tables with many to many relationships?

2021-11-20 Thread Lalit Suthar
refer: https://docs.djangoproject.com/en/2.2/topics/db/examples/many_to_many/ On Sat, 13 Nov 2021 at 00:08, Madhav Dhungana wrote: > *What I want?* > > 1 ) I want to add pages and pull the page meta data from pagemeta table. > One page will have more than on pagemeta. > >1. > >PageMeta T

How to retrive data from more than two tables with many to many relationships?

2021-11-12 Thread Madhav Dhungana
*What I want?* 1 ) I want to add pages and pull the page meta data from pagemeta table. One page will have more than on pagemeta. 1. PageMeta Table , will have section(many to many relationship) and key and value like: Keyname: _contact_collapse Value: People usually ask these

Re: Many to Many relationships in template

2020-02-27 Thread Gil Obradors
Hi! https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#modeladmin-objects or https://docs.djangoproject.com/en/3.0/intro/tutorial07/#writing-your-first-django-app-part-7 Missatge de Robb Rodirguez Jr. del dia dv., 28 de febr. 2020 a les 1:14: > Good day guys, im new to django im having in

Many to Many relationships in template

2020-02-27 Thread Robb Rodirguez Jr.
Good day guys, im new to django im having in many to many relationship display in template How can display this into a normal list.. from . , , , , ]> to. webadmin kim sem quinito user1 Here's my code model.py class ListOfUser(models.Model): users = models.ManyToManyField(User, verbos

Re: big legacy database with complex many to many relationships

2014-02-24 Thread Tom Evans
On Mon, Feb 24, 2014 at 7:54 PM, Sells, Fred wrote: > I have to integrate to a large read only legacy mssql database . > > > > The many-to-many tables have a lot of additional fields like start/end dates > of the relationship and their own naming conventions > > > > Can anyone point me to some lin

RE: big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
database with complex many to many relationships On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred wrote: > I have to integrate to a large read only legacy mssql database . while certainly it's possible to configure this as a second database and use the ORM, I've found that it's more

Re: big legacy database with complex many to many relationships

2014-02-24 Thread Javier Guerra Giraldez
On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred wrote: > I have to integrate to a large read only legacy mssql database . while certainly it's possible to configure this as a second database and use the ORM, I've found that it's more work than usually needed. especially if you already have defined

big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
I have to integrate to a large read only legacy mssql database . The many-to-many tables have a lot of additional fields like start/end dates of the relationship and their own naming conventions Can anyone point me to some links that treat this topic in depth. I've looked at the django book an

Re: How to edit many-to-many relationships with data from custom intermediary table?

2013-08-21 Thread DJ-Tom
I'm not sure what the easiest way would be to make the Quantity field > editable - I thought about a* fieldset *but how do I get the data from > the intermediary table into that??? > > ooops - I meant FORMset, not fieldset... (why is there no way to edit my own post?) -- You received this m

How to edit many-to-many relationships with data from custom intermediary table?

2013-08-21 Thread DJ-Tom
Hi, I'm currently working on a room management application for events. One part of it is a list of room setups with associated equipment, each room can have an arbitrary number of different equipment (such as screens, IT-equipment, A/, tables etc.) Each equipment also has an attribute "number

Problem with saving many to many relationships

2011-10-24 Thread basd basd
I'm trying to set up a many to many relationship, but when I save the model I get "TypeError: 'layer_set' is an invalid keyword argument for this function". In class Experiment(Job) I declare the model with: layer_set = models.ManyToManyField(LayerSet, blank=True, default = "default layer"

Re: inlineformset_factory and many-to-many relationships

2011-04-27 Thread Kenny Meyer
Hi Rosemarie, Try a quick google search with terms like "django has no ForeignKey to " and you'll get a bunch of results. I promise. Here's only one of those results: http://stackoverflow.com/questions/609556/django-admin-inlining-foreign-key-issue AFAICS this issue has been discussed various t

Re: inlineformset_factory and many-to-many relationships

2011-04-27 Thread Rosemarie
ahh, and class MemberForm(ModelForm): class Meta: model = member exclude = ('password','date_joined','username','is_staff','is_active','last_login','is_superuser','firstAid') it has the class Meta: that's not the problem. Sorry, I'm all over the place here! -- You received this

Re: inlineformset_factory and many-to-many relationships

2011-04-27 Thread Rosemarie
Oh yeah, and the exact error I am currently getting is Exception at /members/edit/ has no ForeignKey to -- 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 thi

inlineformset_factory and many-to-many relationships

2011-04-27 Thread Rosemarie
ahh, feeling very frustrated, hopefully someone can enlighten me :) -Creating a form to edit a "member" model -Member has a few many-to-many relationships. -I was initially getting an error about not being able to update m2m unless you use the manager for the other table -After googlin

Re: Two way many-to-many relationships

2011-03-29 Thread Mike Ramirez
On Monday, March 28, 2011 02:32:52 pm Dilan wrote: > Thanks Mike ! you're welcome > That was a really helpful page that I missed in Doc. In this > particular case 1 solves 2. > Nice > > In python you can't forward declare outside of the module the object is > > in. I also want to clarify that

Re: Two way many-to-many relationships

2011-03-28 Thread Dilan
Thanks Mike ! That was a really helpful page that I missed in Doc. In this particular case 1 solves 2. Dilan On Mar 27, 10:09 pm, Mike Ramirez wrote: > On Sunday, March 27, 2011 02:32:15 pm Dilan wrote: > > > Hi All, > > > I'm working on a model similar to > >http://docs.djangoproject.com/en/1

Re: Two way many-to-many relationships

2011-03-27 Thread Mike Ramirez
On Sunday, March 27, 2011 02:32:15 pm Dilan wrote: > Hi All, > > I'm working on a model similar to > http://docs.djangoproject.com/en/1.3/topics/db/models/#extra-fields-on-many > -to-many-relationships . > > Say, I need to add the field, groups = models.ManyTo

Two way many-to-many relationships

2011-03-27 Thread Dilan
Hi All, I'm working on a model similar to http://docs.djangoproject.com/en/1.3/topics/db/models/#extra-fields-on-many-to-many-relationships . Say, I need to add the field, groups = models.ManyToManyField(Group, through='Membership') to Person class Two questions: 1. In Django,

Re: A Query question about Many-to-many relationships

2010-02-22 Thread Jason
Hi Atamert, Thank you so much! The following statement works! This is really simple but fantastic!!! Publication.objects.filter(article__in = article_qs).annotate(Count('article')) Sincerely, Jason -- You received this message because you are subscribed to the Google Groups "Django users" gro

Re: A Query question about Many-to-many relationships

2010-02-22 Thread Atamert Ölçgen
Hi Jason, On Monday 22 February 2010 09:57:18 Jason wrote: > If I already had a QuerySet of Article named articles, how to get a > QuerySet of Publication by these articles, You can use field lookup operator `in` like this: >>> Publication.objects.filter( >>> article_set__id__in = article_qs

A Query question about Many-to-many relationships

2010-02-21 Thread Jason
Dear All, Model source code: from django.db import models class Publication(models.Model): title = models.CharField(max_length=30) class Article(models.Model): headline = models.CharField(max_length=100) publications = models.ManyToManyField(Publication) If

Many-To-Many relationships with additional attribute

2009-09-28 Thread Myers
extra-fields-on-many-to-many-relationships). So modelling this relation isn't that hard. But how can I provide a clean admin interface. Is it possible with the standard admin functionalities? Related to the Django doc: My problem is, that the intermediate model (membership) is the "entry- poi

how to efficiently use many to many relationships with through tables

2009-09-14 Thread Greg Aumann
I am trying to write my first django app and am unclear about good ways to deal with many to many relationships with through tables. My app is like a bibliography but with lots of links between entries in the bibliography. For example, I want to store links to all the entries cited by other

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-21 Thread Miriam
Hi Russ -- Awesome. I will organize my ideas and start a thread over on django- developers. > I've heard people claim that > this is possible in Rails (also in SQLAlchemy), but I've never had > enough of an itch to go looking and see if this is true, and if so, > how they implement it. This is

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-20 Thread Jason Beaudoin
Miriam, If you do take this to django-developers, please post a link here, at least.. this would be greatly appreciated. Thanks :) ~Jason On Mon, Jul 20, 2009 at 7:39 PM, Russell Keith-Magee wrote: > > On Mon, Jul 20, 2009 at 11:21 PM, Miriam wrote: > > > > Hi Russ -- > > > > Thanks for your r

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-20 Thread Russell Keith-Magee
On Mon, Jul 20, 2009 at 11:21 PM, Miriam wrote: > > Hi Russ -- > > Thanks for your response. I figured there must have been discussion on > this at some point, given that this is a pretty common use case, and > one that other ORMs already tackle with varying degrees of success. Is > there a ticket

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-20 Thread Miriam
Hi Russ -- Thanks for your response. I figured there must have been discussion on this at some point, given that this is a pretty common use case, and one that other ORMs already tackle with varying degrees of success. Is there a ticket on the subject? If so, I'd love to shift the conversation ov

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-18 Thread Matthias Kestenholz
Hey, On Fri, Jul 17, 2009 at 5:06 PM, Miriam wrote: > > There currently is no way in Django to pre-fetch one-to-many and/or > many-to-many relationships, right? > > There's select_related, which will pre-fetch FK or one-to-one, which > is great, but not sufficient. >

Re: pre-fetch one-to-many and many-to-many relationships

2009-07-17 Thread Russell Keith-Magee
On Fri, Jul 17, 2009 at 11:06 PM, Miriam wrote: > > There currently is no way in Django to pre-fetch one-to-many and/or > many-to-many relationships, right? Correct. > There's select_related, which will pre-fetch FK or one-to-one, which > is great, but not sufficient. >

pre-fetch one-to-many and many-to-many relationships

2009-07-17 Thread Miriam
There currently is no way in Django to pre-fetch one-to-many and/or many-to-many relationships, right? There's select_related, which will pre-fetch FK or one-to-one, which is great, but not sufficient. Suppose I am fetching a list of Blog posts and I want to pre-fetch the Comments for ea

Re: Problem with Model Forms and Reverse Many-to-Many Relationships

2009-06-01 Thread Jashugan
Here's my workaround, if anyone else is interested how to overcome this problem: http://www.pastie.org/497309 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Problem with Model Forms and Reverse Many-to-Many Relationships

2009-06-01 Thread Jashugan
How do you create a model form that contains a reverse many-to-many relationship? My attempt: http://pastie.org/497284 failed: AttributeError: 'RelatedObject' object has no attribute 'unique' --~--~-~--~~~---~--~~ You received this message because you are subs

Re: Admin and permissions on many to many relationships.

2009-05-29 Thread Karen Tracey
On Fri, May 29, 2009 at 5:45 AM, will0 wrote: > > Dear All, > > Take two models - "Contact" which has a many to many relationship with > "MailList" (defined on MailList). > > When a user who only has permissions to delete from Contact attempts > to delete any contact, whether or not they're in a

Admin and permissions on many to many relationships.

2009-05-29 Thread will0
Dear All, Take two models - "Contact" which has a many to many relationship with "MailList" (defined on MailList). When a user who only has permissions to delete from Contact attempts to delete any contact, whether or not they're in a mail list, they get a permission denied message. """ Deleting

Re: Ordering in with Many-to-Many Relationships

2008-09-17 Thread TiNo
/topics/db/models/#extra-fields-on-many-to-many-relationships Here you could specify a field called order. To display you select everythong from the intermedirary model 'grouped_by=reel, order_by=order'. Does this make any sense :D? On Wed, Sep 17, 2008 at 8:51 PM, sethpomerantz <[EM

Ordering in with Many-to-Many Relationships

2008-09-17 Thread sethpomerantz
Hi, I am building a simple web app that allows me to create a custom web page of different quicktimes for presentation to clients and the like. I have it working fine , however i'd like to add control over the ordering of the quicktimes on the display pages. I am having a tough time understanding

admin interface, search fields for many-to-many relationships

2007-09-13 Thread Alice
I'm running into trouble using the admin interface's search feature, probably due to the default way that tables are being joined. I have an Actor and a Group, and a many-to-many relationship between them. (So Actors can be in multiple Groups, and Groups can have multiple Actors). For the Group ob

permissions and many-to-many relationships

2007-08-17 Thread simonbun
I'm working on a sort of integrated email system where an OutboundEmail can be sent to any number of Users. So naturally my OutboundEmail model has an m2m relationship to User. Today I've been fiddling with permissions on the User model. To my amazement I need "change" permissions on OutboundEmai

Re: self referential many to many relationships

2007-05-12 Thread Russell Keith-Magee
On 5/13/07, C <[EMAIL PROTECTED]> wrote: > > Ok, I've run upon another stumbling block. I did as you recommended > and created a Relation model. I'd like to be able to edit/create a > Relation inline with a Part in the django admin. > > The example provided in the tutorial for editing inline doe

Re: self referential many to many relationships

2007-05-12 Thread C
Ok, I've run upon another stumbling block. I did as you recommended and created a Relation model. I'd like to be able to edit/create a Relation inline with a Part in the django admin. The example provided in the tutorial for editing inline doesn't work in this situation. Is it doable at all?

Re: self referential many to many relationships

2007-04-17 Thread C
Thanks for your help, Russ. Your example does exactly what I want I think. C On Apr 17, 8:10 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 4/18/07, C <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I am building a simple parts database as a fun "learn django" project. > > A "part" i

Re: self referential many to many relationships

2007-04-17 Thread Russell Keith-Magee
On 4/18/07, C <[EMAIL PROTECTED]> wrote: > > Hi, > > I am building a simple parts database as a fun "learn django" project. > A "part" in my test application has a part number, description, etc > and can optionally be composed of other parts. This sounded to me > like a good candidate for a self

self referential many to many relationships

2007-04-17 Thread C
Hi, I am building a simple parts database as a fun "learn django" project. A "part" in my test application has a part number, description, etc and can optionally be composed of other parts. This sounded to me like a good candidate for a self referring many to many relationship. I got it coded a

Re: Many-To-Many relationships, select_related()

2007-01-05 Thread Aidas Bendoraitis
I can think of a couple of ways: 1. Using intermediate table for Many-to-many relationship: class UserPermission(models.Model): user = models.ForeignKey(User) permission = models.ForeignKey(Permission) user_permissions = UserPermission.objects.select_related().all() 2. Writing some custo

Many-To-Many relationships, select_related()

2007-01-03 Thread Trey
Is there a problem in django's many-to-many relationship mapper when it comes to selecting the related fields? In this simple example I have a user with permissions and they are related via an intermediary table. "select_related()" only brings back the User object and each access of a Permission

complex expressions in many-to-many relationships

2006-08-26 Thread AlexK
Hi all, May be I'm too demanding to django Db API, but anyway.. OK, I have many-to-many relationship Story >-< Image. I want to get all images which bound to a story and with 'caption' or 'img' fields applied search condition string 'conditionString'. If I write (ver 0.91): from django.models.

Re: Chaining filter & exclude weirdness in many-to-many relationships

2006-08-13 Thread Malcolm Tredinnick
On Sun, 2006-08-13 at 17:14 -0700, [EMAIL PROTECTED] wrote: > I'm trying to get a queryset of all users in two particluar groups that > *aren't* in a third particular group. This same conversation is going on in another thread at the moment, so let me explain the general case: any chained filter

Chaining filter & exclude weirdness in many-to-many relationships

2006-08-13 Thread [EMAIL PROTECTED]
I'm trying to get a queryset of all users in two particluar groups that *aren't* in a third particular group. Here's what I tried*: User.objects.filter(groups__in=(author_group, guide_group)).exclude(groups=staff_group) This is the SQL produced: SELECT * FROM auth_user LEFT OUTER JOIN auth_user_

Re: Problem with built-in User in many-to-many relationships

2006-06-27 Thread bsdlogical
Malcolm Tredinnick wrote: On Tue, 2006-06-27 at 23:53 -0400, bsdlogical wrote: I've recently stumbled over a problem whose solution I can't find. I have a class with two fields that use the built-in User class (from django.contrib.auth.models) in a many-to-many relationship. Howeve

Re: Problem with built-in User in many-to-many relationships

2006-06-27 Thread Malcolm Tredinnick
On Tue, 2006-06-27 at 23:53 -0400, bsdlogical wrote: > I've recently stumbled over a problem whose solution I can't find. I > have a class with two fields that use the built-in User class (from > django.contrib.auth.models) in a many-to-many relationship. However, > when I try to access or modify

Problem with built-in User in many-to-many relationships

2006-06-27 Thread bsdlogical
I've recently stumbled over a problem whose solution I can't find. I have a class with two fields that use the built-in User class (from django.contrib.auth.models) in a many-to-many relationship. However, when I try to access or modify those fields, django throws an error message. My class declar

Re: Using Exclude w/ Many to Many Relationships

2006-06-22 Thread rajesh . dhawan
Malcolm is dead on! In fact, I should've mentioned that the case that works for me is an inclusion query rather than an exclusion e.g. find all articles that have the topic soccer, where articles and topics have a many-to-many relationship. For exclusions like the one sought by the OP, an extra

Re: Using Exclude w/ Many to Many Relationships

2006-06-22 Thread Malcolm Tredinnick
On Thu, 2006-06-22 at 15:48 +, [EMAIL PROTECTED] wrote: > I have found that, in some cases, the following also works (I have a > similar model where using the slug of the related object does not work > but using it's PK works): > > tag_id = Tag.objects.get(tag = 'nopush').id > x = Server.obje

Re: Using Exclude w/ Many to Many Relationships

2006-06-22 Thread rajesh . dhawan
I have found that, in some cases, the following also works (I have a similar model where using the slug of the related object does not work but using it's PK works): tag_id = Tag.objects.get(tag = 'nopush').id x = Server.objects.exclude(tags__id__exact=tag_id) This may be because using the id sa

Re: Using Exclude w/ Many to Many Relationships

2006-06-21 Thread Malcolm Tredinnick
On Wed, 2006-06-21 at 12:08 -0700, loki77 wrote: > I am messing with a server database that I've written in Django, and > I'm running into something that for some reason I can't figure out. > > Just some dependency info: > * Using Django from the svn repository- checked out revision 3189. > > I

Re: Using Exclude w/ Many to Many Relationships

2006-06-21 Thread loki77
Sorry, I forgot to mention: There are around 300 servers WITHOUT the nopush tag in the database, and that's the set of servers I would like to return. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" g

Using Exclude w/ Many to Many Relationships

2006-06-21 Thread loki77
I am messing with a server database that I've written in Django, and I'm running into something that for some reason I can't figure out. Just some dependency info: * Using Django from the svn repository- checked out revision 3189. I have two types of objects (well, more, but the others aren't in

Many-to-many relationships via an intermediary table

2006-06-15 Thread [EMAIL PROTECTED]
Hi, I have a News model with a field in it called Topic: topic = model.ManyToManyField(Topic) Now I would like to add a Sequence field to the intermediary table and as it has been suggested, I should delete the ManyToMany field from the News model and create the intermediery table by hand. class

Re: Many-to-many relationships

2005-09-12 Thread Adrian Holovaty
On 9/12/05, stane <[EMAIL PROTECTED]> wrote: > If I have declare explicitly primary keys ex. article_id and > publication_id then p1.get_article_list() fails > > Traceback (most recent call last): > File "", line 1, in ? > File "C:\Python23\lib\site-packages\django\utils\functional.py", line > 3,

Many-to-many relationships

2005-09-12 Thread stane
If I have declare explicitly primary keys ex. article_id and publication_id then p1.get_article_list() fails Traceback (most recent call last): File "", line 1, in ? File "C:\Python23\lib\site-packages\django\utils\functional.py", line 3, in _curried return args[0](*(args[1:]+moreargs), **dict(kw