0

Here is my models.py file. When I try to migrate it gives me an error.

I changed Class name and it gives me an error. Now if I put even old name, it gives me the same error

from django.db import models
from tinymce.models import HTMLField



class BlockTags(models.Model):
    pass

class BlockTags_Text(models.Model):
    text = models.CharField(max_length=300, verbose_name='Заголовок 1', null=True, blank=True)
    block = models.ForeignKey(BlockTags, related_name="text", verbose_name='Заголовок 1', on_delete=models.CASCADE, null=True,blank=True)
    number = models.DecimalField(max_digits=3, decimal_places=0)







ValueError: The field content.BlockTags.text was declared with a lazy reference to 'content.blocktags_text', but app 'content' doesn't provide model 'blocktags_text'.
(venv) appledeMacBook-Pro:letbuycar apple$ 

1 Answer 1

1

app 'content' doesn't provide model 'blocktags_text'.

This means that django doesnt see a blocktags_text model in your models.py, try running makemigrations and then migrate, also try adding at least one field to your empty model.

Sign up to request clarification or add additional context in comments.

6 Comments

tried to migrate, it gives ValueError: Related model 'content.blocktags_text' cannot be resolved
run makemigrations again then migrate
same thing, for makemigrations this error The field content.BlockTags.text was declared with a lazy reference to 'content.blocktags_text', but app 'content' doesn't provide model 'blocktags_text'. for migrate this ValueError: Related model 'content.blocktags_text' cannot be resolved
try deleting all your migration files then running makemigrations -> migrate again
Np, please accept the answer if it helped, maybe it will help others also :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.