On 6 jan, 13:42, Polat Tuzla <ptu...@gmail.com> wrote:
> Hi,
> Suppose I have two classes in "models.py", namely A and B. And there
> is the manager for B as BManager in "managers.py". BManager makes use
> of clas A.
>
> This situation leads to circular imports between "managers.py" and
> "models.py" for which I can't find a solution.
>
> Assuming that I need to separate models and manager into different
> files, so merging them is not an option, are there any best practices
> or do you have any other suggestions?

The import statement works fine in a method too.

class BManager(...):
   def some_method(self):
       from models import A
       # code here


But I have hard time understanding why you couldn't put models and
managers in the models file...
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to