Re: Foreign key problem

2011-10-14 Thread Guy Nesher
nm, solved On Oct 14, 1:54 pm, Guy Nesher wrote: > Hi DR, > > Thanks, I've just started developing in Python/Django so I do > apologize for the bad naming convention (I'll fix this once everything > works, don't want to add additional errors before I sort this). > > Having said that I assumed tha

Re: Foreign key problem

2011-10-14 Thread Guy Nesher
Hi DR, Thanks, I've just started developing in Python/Django so I do apologize for the bad naming convention (I'll fix this once everything works, don't want to add additional errors before I sort this). Having said that I assumed that if I define the foreignkey manually and specifically select a

Re: Foreign key problem

2011-10-14 Thread Daniel Roseman
On Friday, 14 October 2011 12:44:45 UTC+1, Guy Nesher wrote: > > > Hi, > > I'm trying to populate a table with 2 foreign keys using a csv file > and keep getting the following error : > Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a > "Restaurant" instance. > > I tried to man

Foreign key problem

2011-10-14 Thread Guy Nesher
Hi, I'm trying to populate a table with 2 foreign keys using a csv file and keep getting the following error : Cannot assign "238": "PrizetoRestaurant.RestauranttId" must be a "Restaurant" instance. I tried to manually define the primary keys in those tables, and I'm making sure I int() the data

Re: model inheritance with foreign key problem

2009-01-16 Thread Karen Tracey
On Fri, Jan 16, 2009 at 7:14 AM, Marco Minutoli wrote: > > I have these three models: > > class Address(models.Model): >name = models.CharField(max_length=100) >## many other fields ## > >class Meta: >ordering = ('name',) > >def __unicode__(self): >return self.name

model inheritance with foreign key problem

2009-01-16 Thread Marco Minutoli
I have these three models: class Address(models.Model): name = models.CharField(max_length=100) ## many other fields ## class Meta: ordering = ('name',) def __unicode__(self): return self.name class Organization(models.Model): name = models.CharField(max_le

Re: Foreign Key Problem

2008-10-24 Thread cwurld
> > ALTER TABLE ENGINE=INNODB; > I changed all my tables to InnoDB. That seems to have solved the problem. Thanks for the suggestion. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Foreign Key Problem

2008-10-23 Thread bruno desthuilliers
On 23 oct, 19:53, cwurld <[EMAIL PROTECTED]> wrote: > Hi, (snip) > > When I run syncdb, the table is created (I can see it with MySQL > Admin), but I get the following error: > > > C:\Documents and

Foreign Key Problem

2008-10-23 Thread cwurld
Hi, I have been using django for about a year and a half. It has been great. My hat is off to all the developers. I am trying to port my project to django 1.0 for 0.97. I am using MySQL. The ported version seems to be working well. The problem is that am trying to add a new model that contains

Re: Foreign Key problem

2008-07-07 Thread rui
blog.id dosen´t do the trick ? Smith, you should look at ManyToMany relationships. These wiil make you models more readable and easy to deal with. Give a look here: http://www.djangoproject.com/documentation/model-api/ Cheers -- Rui On Mon, Jul 7, 2008 at 8:07 AM, smith <[EMAIL PROTECTED]> wr

Foreign Key problem

2008-07-07 Thread smith
hi As I am new to django I am having a lots of problem.. So my query is: class Blog(models.Model): name = models.CharField(maxlength=100) class Entry(models.Model): blog = models.ForeignKey(Blog) headline = models.CharField(maxlength=255) class content(models.Model): name = models

Re: order_by foreign key problem

2008-05-30 Thread Karen Tracey
On Fri, May 30, 2008 at 6:09 PM, robstar <[EMAIL PROTECTED]> wrote: > > Thanks for your help Richard.. taking out the select_related() > results in the same problem. Isn't a OnetoOneField just a fancy name > wrapper for a foreign key?? > > mysql> describe itemengine_gear; > +-+-

Re: order_by foreign key problem

2008-05-30 Thread robstar
Thanks for your help Richard.. taking out the select_related() results in the same problem. Isn't a OnetoOneField just a fancy name wrapper for a foreign key?? mysql> describe itemengine_gear; +-+--+--+-+-+---+ | Field | Type |

Re: order_by foreign key problem

2008-05-29 Thread Johannes Dollinger
Wah, nevermind .. Am 30.05.2008 um 01:27 schrieb Johannes Dollinger: > >> Should this work?? >> >> results = Gear.objects.select_related().order_by >> (generic_info__hits) > > Quotes are missing: > > Gear.objects.select_related().order_by('generic_info__hits') > > > > > > > --~--~-

Re: order_by foreign key problem

2008-05-29 Thread Johannes Dollinger
> Should this work?? > > results = Gear.objects.select_related().order_by(generic_info__hits) Quotes are missing: Gear.objects.select_related().order_by('generic_info__hits') --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: order_by foreign key problem

2008-05-29 Thread Richard Dahl
I am not sure what is going on, however I wonder if it has something to do with the OneToOne relationship, I do not use onetoone myself but notice in the following from the db-api documentation: Note that the select_related() QuerySet method recursively prepopulates the cache of all one-to-many re

Re: order_by foreign key problem

2008-05-29 Thread robstar
Oops, I had the ' ' in there somewhere in all my different iterations of trying to make this work .. so the query works, but I can't access the object in the template, or from the shell for that matter. Does something change by doing this type of query? On the shell: >>> gear = Gear.objects.se

Re: order_by foreign key problem

2008-05-29 Thread robstar
Oops, I had the ' ' in there somewhere in all my different iterations of trying to make this work .. so the query works, but I can't access the object in the template, or from the shell for that matter. Does something change by doing this type of query? On the shell: >>> gear = Gear.objects.se

Re: order_by foreign key problem

2008-05-29 Thread Richard Dahl
http://www.djangoproject.com/documentation/db-api/ contains the info you want. Try this: Gear.objects.select_related().order_by('generic_info__hits') you could also set the order_by in the Meta of Item to hits and then you could just do: Gear.objects.select_related().order_by('generic_info') ht

order_by foreign key problem

2008-05-29 Thread robstar
Hey guys, I read through some of the threads here, but still can't get this simple scenario to work.. DB name: gcdb class Item(models.Model): hits= models.IntegerField(default=0) class Gear(models.Model): generic_info= models.OneToOneField(Item) Should this work?? res

Re: admin and foreign key problem

2008-05-25 Thread M.Ganesh
Karen Tracey wrote: > On Sat, May 24, 2008 at 11:11 PM, M.Ganesh <[EMAIL PROTECTED] > > wrote: > > > Hi All, > > Having some problem with foreign key and admin interface : > > > #models-

Re: admin and foreign key problem

2008-05-24 Thread Karen Tracey
On Sat, May 24, 2008 at 11:11 PM, M.Ganesh <[EMAIL PROTECTED]> wrote: > > Hi All, > > Having some problem with foreign key and admin interface : > > > #models--- > class tagword(models.Model): >name = models.Ch

admin and foreign key problem

2008-05-24 Thread M.Ganesh
Hi All, Having some problem with foreign key and admin interface : #models--- class tagword(models.Model): name = models.CharField(max_length=50) def __unicode__(self): return self.name clas