I’m working on a custom field that is just a shortcut to ForeignKey that points to addresses.Country model. When I run makemigrations it returns this error with I’m not sure: I understand that there are two to arguments passed but I don’t understand why. It looks like the field is initialized two times. Once with the kwargs I provided and
Tag: django-migrations
Django 2.2 cannot serialize default values once migration has been done
I have a model which is refered to as a foreignkey with on_delete set to SET_DEFAULT. Because of that, I need to provide this model with a default item. I created a static method which does just that. …
How to populate auth.groups and auth.group_permissions tables with initial data in Django project
Context I am using PostgreSQL. I would like to immediately populate the auth.groups and auth.group_permissions tables, after the very first migration of my project. So, after I have set up these …
Handling data during django migrations?
class Material(models.Model): name = models.CharField(max_length=50, blank=False) short_name = models.CharField(max_length=2, blank=False, unique=False, default=’Al’) def __str__(self):…
“OperationalError: no such table: django_site” when running makemigrations with empty database when using Django-todo
I have inherited a Django 1.11.6 application from another developer. Now after I have made a lot of changes to the code and data model, I want to re-create the sqlite database from scratch. But when …
InvalidBasesError: Cannot resolve bases for []
When I run tests I get this error during database initialization: django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [
Django migration strategy for renaming a model and relationship fields
I’m planning to rename several models in an existing Django project where there are many other models that have foreign key relationships to the models I would like to rename. I’m fairly certain this …