Here are my Django models, which have multiple many to many relationships.
class Theme(models.Model):
theme_name = Models.CharField(max_length=20)
theme_ind = Models.CharField(max_length=1)
class Topics(models.Model):
topic_name = Models.CharField(max_length=20)
class Language(models.Model):
lang_name = models.CharField(max_length=10)
class Article(models.Model):
name = Models.CharField(max_length=10)
url = Models.CharField(max_length=50)
lang_id = models.ManyToManyField(Language, related_name='theme')
theme_id = models.OneToOneField(Theme, related_name='theme')
topic_id = models.ManyToManyField(Topics, related_name='topic')
Question: When I run:
python manage.py sqlmigrate polls
I get this error:
manage.py sqlmigrate: error: too few arguements.
From the docs, sqlmigrate
also requires the migration name:
python manage.py sqlmigrate polls <migration_name>
You forgot the prefix of makemigrations command output file.
When you run:
python manage.py makemigrations polls
You will see in output 0001_any_name.py
.
Here, 0001 is used in sqlmigrate
for creating the database that you forgot to add in your command.
So, write:
python manage.py sqlmigrate polls 0001
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With