Its very strange that so "hard linked" applications can produce clean and logic architecture:)
1. Try to split your A's models.py into 2 files. A1, A2 in first file. A3 in second file. In first models file import second with wildcard(*). In B models.py import only second A file. It's only suggestion. I don't check it. 2. Yes you can use model name as string. But that model my be in the same module. On 8 янв, 16:24, Grindizer <[EMAIL PROTECTED]> wrote: > Hello. > I have a project with at least 2 applications > A, which define ModelA1, ModelA2, ModelA3 (and other). > B, which define ModelB1, ModelB2. > > And I have these dependencies: > In A: > - ModelsA1 need as a foreign key ModelB1 > - ModelsA2 need ModelB2 (ManyToManyField) > > In B: > - ModelB2 need ModelA3 (Foreign Key) > > So in B I have: > from A import ModelA3 > > And in A i have. > from B import ModelsB1, ModelB2 > > But when I do syncdb it say that ModelA3 cannot be imported in > application A and in application B. > I think that, this is because there is a circular import (module A > import B which import A), I don't want to change my project > architecture because it is logic and clean, so I tried to go ahead and > I found that we can specify a 'string' in the foreign key field > constructor ! > > I tried to put the name of my model 'B.ModelB1', thinking that the > string will be converted in a Model object later (which may avoid > error at syncdb) but it seems that it doesn't work. (The string is > viewed as a model, and error occur when we try to access the attribute > _meta of the model passed in parameter, but the parameter is a string > object so error.) > > So my question is: > - Are there any solution, without reorganizing my project to solve the > problem? > - Can we really specify other things that a Model object or 'self' in > a foreign key contractor, and if the answer is yes, how? > > Thank you in advance. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---