Re: Problem with two applications importing models from each other?

2008-01-11 Thread Grindizer
On 10 jan, 22:00, Josh Ourisman <[EMAIL PROTECTED]> wrote: > It's for the purpose of defining foreign keys. Basically, ClassA1 > needs to be able to reference ClassB1 and ClassB2 as foreign keys, > while ClassB3 needs to reference ClassA1 as a foreign key. > > More specifically, the project has

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Josh Ourisman
Ok, that should help. Thanks very much. On Jan 10, 4:58 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Jan 10, 4:00 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote: > > > It's for the purpose of defining foreign keys. Basically, ClassA1 > > needs to be able to reference ClassB1 and ClassB2 as

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Rajesh Dhawan
On Jan 10, 4:00 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote: > It's for the purpose of defining foreign keys. Basically, ClassA1 > needs to be able to reference ClassB1 and ClassB2 as foreign keys, > while ClassB3 needs to reference ClassA1 as a foreign key. By now you know why this isn't

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Josh Ourisman
It's for the purpose of defining foreign keys. Basically, ClassA1 needs to be able to reference ClassB1 and ClassB2 as foreign keys, while ClassB3 needs to reference ClassA1 as a foreign key. More specifically, the project has (among others) a news application and a portfolio application. An

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Rajesh Dhawan
Hi, On Jan 10, 12:54 pm, Josh Ourisman <[EMAIL PROTECTED]> wrote: > I have two models, modelA and modelB. ModelA needs classB1 and classB2 > from modelB, while modelB needs classA1 from classA. Can you explain what you mean by "needs"? Is there a class method in modelA that needs to

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Josh Ourisman
Nope, that just gets me "AttributeError: 'module' objects has no attribute 'models'". :/ It doesn't work to just to 'import modelA' and then reference modelA.Class1 or modelA.models.Class1 either; that just gives me the same error. On Jan 10, 2:38 pm, Muchanic <[EMAIL PROTECTED]> wrote: >

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Muchanic
import xxx means 'import module xxx' - since Class1 is a class, and not a module, that won't work. If you change the import statements in both modules to something of the form 'import modelA.models as models_A' then referencing the classes as 'models_A.Class1', does that work? On Jan 11, 8:27 

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Josh Ourisman
Hmm. That implies that I should be using 'import modelA.models.Class1' rather than 'from modelA.models import Class1'. However, that syntax doesn't seem to actually work. If I remove the circular imports for a moment, 'from modelA.models import Class1' works just fine, but if I use 'import

Re: Problem with two applications importing models from each other?

2008-01-10 Thread Muchanic
Check this out: http://www.python.org/doc/faq/programming/#what-are-the-best-practices-for-using-import-in-a-module On Jan 11, 6:54 am, Josh Ourisman <[EMAIL PROTECTED]> wrote: > I have two models, modelA and modelB. ModelA needs classB1 and classB2 > from modelB, while modelB needs classA1

Problem with two applications importing models from each other?

2008-01-10 Thread Josh Ourisman
I have two models, modelA and modelB. ModelA needs classB1 and classB2 from modelB, while modelB needs classA1 from classA. So, in the models.py file for modelA I have 'from modelB.models import classB1, classB2'. This worked just fine until I added to the models.py file for modelB 'from

Re: Importing models from each other.

2006-10-04 Thread Holger Schurig
> I try to import like: "import myproject" and then > myproject.auth.models.User but no luck, Django throws error, > that auth has no models class. Is there a way to make this to > work? For this kind of problem it helps sometimes to use the "-v" option to python, e.g. python -v ./manage.py

Re: Importing models from each other.

2006-10-03 Thread Gacha
I separated the models. Now I have myproj.extra which contains the Choice model and all works fine :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: Importing models from each other.

2006-10-02 Thread Malcolm Tredinnick
On Mon, 2006-10-02 at 06:41 -0700, Gacha wrote: > I try to import like: "import myproject" and then > myproject.auth.models.User but no luck, Django throws error, that auth > has no models class. Is there a way to make this to work? I don't really have any ideas of the top of my head. However,

Re: Importing models from each other.

2006-10-02 Thread Gacha
I try to import like: "import myproject" and then myproject.auth.models.User but no luck, Django throws error, that auth has no models class. Is there a way to make this to work? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Importing models from each other.

2006-09-27 Thread Malcolm Tredinnick
On Thu, 2006-09-28 at 02:42 +, Gary Wilson wrote: > Gacha wrote: > > I have two model files, the first is: > > --- > > from proj.base.models import Choice > > > > class User(meta.Model): > > ... > > param =

Re: Importing models from each other.

2006-09-27 Thread Gacha
Nope, it didn't work :( but thx for a try --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group,

Re: Importing models from each other.

2006-09-27 Thread Steven Armstrong
On 09/27/06 16:03, Gacha wrote: > I have two model files, the first is: > --- > from proj.base.models import Choice > > class User(meta.Model): > ... > param = model.ForeignKey(Choice) > >

Re: Importing models from each other.

2006-09-27 Thread Gacha
Yes, I already know that :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to

Re: Importing models from each other.

2006-09-27 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > You need to pass the model name as a string: > user = model.ForeignKey("User") Actually i'm seeing you knew that already, yes to use the technique above you need to have all models in the same file. Lorenzo --~--~-~--~~~---~--~~ You

Re: Importing models from each other.

2006-09-27 Thread [EMAIL PROTECTED]
Gacha wrote: > user = model.ForeignKey(User) You need to pass the model name as a string: user = model.ForeignKey("User") Lorenzo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Importing models from each other.

2006-09-27 Thread Gacha
I have two model files, the first is: --- from proj.base.models import Choice class User(meta.Model): ... param = model.ForeignKey(Choice) --- and the