Re: How do I join two existing tables?
>> managed=False << Thanks for pointing that out. On Sunday, February 24, 2013 11:10:07 AM UTC-5, Johan wrote: > > You're welcome. > > You probably also want to make sure that in the class Meta options, you've > set managed=False > Otherwise you could accidentally change the database definitions. > > All the information is here: > https://docs.djangoproject.com/en/dev/howto/legacy-databases/ > > On Feb 24, 2013, at 5:05 PM, frocco > > wrote: > > Thank you > > On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote: >> >> Hi, >> >> I have to interface with an existing php app and the key field is >> character. >> >> paginator = >> Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search), >> >> 20) >> I want to add to the above and pull the related category. >> >> Shopcategories has a character prime key called category_id >> Shopinventory has a character field called category_id >> It is a one to one relation, but inspected did not create any foreign >> keys. >> >> Thanks >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users...@googlegroups.com . > To post to this group, send email to django...@googlegroups.com > . > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How do I join two existing tables?
You're welcome. You probably also want to make sure that in the class Meta options, you've set managed=False Otherwise you could accidentally change the database definitions. All the information is here: https://docs.djangoproject.com/en/dev/howto/legacy-databases/ On Feb 24, 2013, at 5:05 PM, frocco wrote: > Thank you > > On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote: > Hi, > > I have to interface with an existing php app and the key field is character. > > paginator = > Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search), > 20) > I want to add to the above and pull the related category. > > Shopcategories has a character prime key called category_id > Shopinventory has a character field called category_id > It is a one to one relation, but inspected did not create any foreign keys. > > Thanks > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How do I join two existing tables?
Thank you On Sunday, February 24, 2013 10:00:58 AM UTC-5, frocco wrote: > > Hi, > > I have to interface with an existing php app and the key field is > character. > > paginator = > Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search), > > 20) > I want to add to the above and pull the related category. > > Shopcategories has a character prime key called category_id > Shopinventory has a character field called category_id > It is a one to one relation, but inspected did not create any foreign keys. > > Thanks > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: How do I join two existing tables?
On Feb 24, 2013, at 4:00 PM, frocco wrote: > Hi, > > I have to interface with an existing php app and the key field is character. > > paginator = > Paginator(Shopinventory.objects.exclude(list_price=0).filter(sizenum__contains=search), > 20) > I want to add to the above and pull the related category. > > Shopcategories has a character prime key called category_id > Shopinventory has a character field called category_id > It is a one to one relation, but inspected did not create any foreign keys. Are you sure it's a One to One relation? Sounds more like a ForeignKey to me. Anyway, you need to change the CharField into a ForeignKey (or a OneToOneField) and tell it the column, something like this: In ShopInventory: category_id = models.ForeignKey(Shopcategories, db_column='category_id') Hope it helps, Johan > > Thanks > > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.