Answer the question
In order to leave comments, you need to log in
Django not finding model?
I have two models:
class User(models.Model):
...
subscriptions = models.ManyToManyField(Channel, verbose_name="подписки", related_name='subscribers')
class Channel(models.Model):
...
authors = models.ManyToManyField(User, verbose_name="автор(ы) канала", related_name="channels")
...
makemigrations
, it gives an error: NameError: name 'Channel' is not defined
Channel
is below. But if you move it higher, then the model is not found User
. Offers?
Answer the question
In order to leave comments, you need to log in
I suggest reading the documentation, where this situation is mentioned and the solution is described - to pass the string name of the model.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question