I have two modules, like this:
--models.py
from myapp.filters import EntityFilter
class Entity(models.Model):
//model definition
def someMethod(self):
entities = EntityFilter(...)
--filters.py
from myapp.models import Entity
class EntityFilter(django_filters.FilterSet):
class Meta:
model = Entity
// ...
Obviously I got error ImportError: cannot import name Entity
How should I reorganize my code?
What do you think about this solution? Is it OK?
class Entity(models.Model):
//model definition
def someMethod(self):
from myapp.filters import EntityFilter
entities = EntityFilter(...)
It works fine...