Wednesday, May 28, 2014

Re: Adding models from one app to another app

On Wed, May 28, 2014 at 11:01 PM, Inderpreet Singh <indrplus@gmail.com> wrote:
> This is directory structure of my django site
> ---- LibreHatti
> |----- src
> |----- useraccounts
> |----- librehatti
> |------- catalog
> |------- reports
>
> Now what we need is to reference a model from useraccounts in
> librehatti.catalog as a foreign key and I am unable to do that.

You may do it like this models of librehatti.
from useraccount import model.modelname

If you want all useraccounts model in librehatti, then do like,
from useraccounts.models import *

> I tried by adding 'appname.modelname' in foreign key field but it actually
> refrences librehatti.useraccounts.address, which is not what I want.
>
> Any help would be appreciated.



--
Satinderpal Singh
http://satindergoraya91.blogspot.in/

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BiK19L9QLuj44cjUnjWoQ_guHWHAkg1VWt2sfr8EZw-RTDnOg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment