Re: ManyToMany relationship with through_fields and Admin

2018-08-28 Thread akash kandpal
What changes you did ? Regards, Akash Kandpal. On Wed, Aug 29, 2018, 12:34 AM Vincent wrote: > I figured it out : > > from django.db import models > from django.contrib.auth.models import User > > > # Create your models here. > class Events(models.Model): > Name = models.CharField(max_length=6

Re: ManyToMany relationship with through_fields and Admin

2018-08-28 Thread Vincent
I figured it out : from django.db import models from django.contrib.auth.models import User # Create your models here. class Events(models.Model): Name = models.CharField(max_length=64) Date = models.DateTimeField() Description = models.CharField(max_length=200) Admin = models.ForeignKey(Use

Re: ManyToMany relationship

2015-08-23 Thread Carlos A. Carnero Delgado
El ago. 23, 2015 3:34 PM, "venkat" escribió: > > How can i overcome this?? > I think you should be using the related_name property in the ManyToMany fields of the model. Giving different names, of course, since that maybe the cause of your problems. It is documented, BTW. HTH, Carlos. -- You r

Re: ManyToMany relationship

2015-08-23 Thread James Schneider
> I have two models as follows > > > class Person(models.Model): > first_name = models.CharField(max_length=30) > last_name = models.CharField(max_length=30) > date_of_birth = models.DateField() > height = models.IntegerField() > def __unicode__(self): > return '%s %s' %(self.first_name, self.last_

Re: ManyToMany relationship and raw sql queries

2013-05-01 Thread Siddharth Ghumre
Hi , Did you try python psycopg2. A simple deomostration. Ex:- import psycopg2 conn=psycopg2.connect("dbname='xxx' user='xxx' host='localhost' password='xxx'") cur = conn.cursor() query="""SELECT * FROM bookmarkmanager_bookmark b ' 'LEFT JOIN bookmarkmanager_bookmark_tags bt

Re: ManyToMany relationship and raw sql queries

2013-04-27 Thread Marc R
did you use Bookmark.objetcs.all().select_related() ? As this will create a join query... at least for your model you show in the message I have found that for very complex joins, you need to use raw query and not a Model. On Thursday, April 25, 2013 10:44:28 AM UTC-4, Matthieu Bouron wrote

Re: ManyToMany relationship and raw sql queries

2013-04-25 Thread Matthieu Bouron
On Thursday, April 11, 2013 5:39:57 PM UTC+2, Tom Evans wrote: > > On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron > > wrote: > > Hello, > > > > Is there a way to handle many-to-many relationship with raw sql queries > ? > > I have the following model: > > > > from django.db import models

Re: ManyToMany relationship and raw sql queries

2013-04-11 Thread Tom Evans
On Thu, Apr 11, 2013 at 3:42 PM, Matthieu Bouron wrote: > Hello, > > Is there a way to handle many-to-many relationship with raw sql queries ? > I have the following model: > > from django.db import models > > class Tag(models.Model): > name = models.CharField(max_length=512, unique=True) > >

Re: ManyToMany relationship with intermediate model and admin list display with each realtion with value as diferent column

2012-07-24 Thread Ignacio Soto
ok, it looks very nice i will try and let you know.. thanks 2012/7/24 Tomas Neme > > > as shown in the picture, this i could do by add a method in the model > > getTienda1 and return the stock and do it for each store, but i want it > to > > be created dinamically because the user could create a

Re: ManyToMany relationship with intermediate model and admin list display with each realtion with value as diferent column

2012-07-24 Thread Tomas Neme
> as shown in the picture, this i could do by add a method in the model > getTienda1 and return the stock and do it for each store, but i want it to > be created dinamically because the user could create a new store and it will > not be there. > > so this is my cuestion: can i do that? Interesting

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Hey Jorge, > The relation disappears when (existing a relation) y use this modelForm > without including any info for the friends field (I don't what to edit this > information at this point). At this moment, django erases the relation > within A an B because wasn't explicit declared and the form

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Jorge Bastida
Hello Rubens,I have similar problems months ago. In my application there is a ManyToMany relation within two classes (A and B) let's name the relation as "friends". The application works fine but in unpredictable situations rows from the auxiliary table that makes the relation disappears randomly.

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Russ, Thanks fo the reply! > The only thought I have is that you appear to be using a pre-existing > table to manage the m2m relationship, rather than the default produced > Django table. This shouldn't pose a problem, but it does lead me to > wonder if there is some other process that could be

Re: ManyToMany relationship being 'lost'?

2009-04-27 Thread Rubens Altimari
Hi Malcolm, >> class BidirectionalField(models.ManyToManyField): >>     def __init__(self, *args, **kwargs): >>         super(BidirectionalField, self).__init__(*args, **kwargs) >>         self.creates_table = False > BY the way, this has been discussed in the past and is really the wrong > way

Re: ManyToMany relationship being 'lost'?

2009-04-25 Thread Malcolm Tredinnick
On Fri, 2009-04-24 at 15:32 -0300, Rubens Altimari wrote: > Hello, > > > Sorry if this is a known issue, but I didn't find anything elsewhere. > > > I have these two models related by a many-to-many relationship. I'm > using the 'default' admin application to edit data, and in order to be > ab

Re: ManyToMany relationship being 'lost'?

2009-04-24 Thread Russell Keith-Magee
On Sat, Apr 25, 2009 at 2:32 AM, Rubens Altimari wrote: > Hello, > Sorry if this is a known issue, but I didn't find anything elsewhere. > I have these two models related by a many-to-many relationship. I'm using > the 'default' admin application to edit data, and in order to be able to > edit bo

Re: ManyToMany relationship on self through other table

2008-10-02 Thread chris
Dear Karen, Thank you very much for your response. It was very helpful and solved my problem! As I said, I am just beginning with Django, so could not quite understand where the problem lies. However, I will try to post a more useful and descriptive phrasing of the problem, including traceback

Re: ManyToMany relationship on self through other table

2008-10-01 Thread Karen Tracey
On Tue, Sep 30, 2008 at 4:52 AM, chris <[EMAIL PROTECTED]> wrote: > > Hi there, > > Just starting to use django, so forgive me if this has been answered > before (a quick search at djanog-search did not turn up something > useful). > What I am trying to do is similar to this (from > http://www.dja

Re: ManyToMany relationship on self through other table

2008-10-01 Thread felix
Exception Value: has more than 1 ForeignKey to hmm. I'm not sure. you might be able to get it to work by fudging something or other. but when it gets complicated like this, and it gets complicated for django's ORM, then I think its better to rearrange the approach. On Oct 1, 2:18 pm, chri

Re: ManyToMany relationship on self through other table

2008-10-01 Thread chris
Dear Felix, Thanks for following up on this. I put the traceback up here: http://paste.pocoo.org/show/86707/ I will try to follow your advice to work around the error and define the tables differently, since you are right about the way this should work in the admin interface. But I still thin

Re: ManyToMany relationship on self through other table

2008-09-30 Thread felix
post the traceback. I may not be able to help you since I haven't tried to do person-to-person at all. it might be simpler to just do Friends and Idols (without using through and without friends and idols being fields on Person) and then add methods to Person that fetch those relationships. or

Re: ManyToMany relationship on self through other table

2008-09-30 Thread chris
On Sep 30, 8:07 pm, felix <[EMAIL PROTECTED]> wrote: > are you actually getting a runtime error or an error when trying to > syncdb ? syncdb works fine, but then I get a runtime error when I want to edit such a record in the admin interface. The traceback complains about the two foreign keys

Re: ManyToMany relationship on self through other table

2008-09-30 Thread felix
are you actually getting a runtime error or an error when trying to syncdb ? On Sep 30, 10:52 am, chris <[EMAIL PROTECTED]> wrote: > Hi there, > > Just starting to use django, so forgive me if this has been answered > before (a quick search at djanog-search did not turn up something > useful). >