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
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 fore
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 working
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 item
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 instantiate/
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:
> import
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 am
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 modelA.
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 from
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 modelA.m
> 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 run
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 django
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, fo
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 Goo
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 = model.Forei
Gacha wrote:
> I have two model files, the first is:
> ---
> from proj.base.models import Choice
>
> class User(meta.Model):
> ...
> param = model.ForeignKey(Choice)
>
>
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, send
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)
>
> ---
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 [EMA
[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 r
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
I have two model files, the first is:
---
from proj.base.models import Choice
class User(meta.Model):
...
param = model.ForeignKey(Choice)
---
and the
22 matches
Mail list logo