On Feb 24, 2013, at 4:00 PM, frocco <[email protected]> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to