6👍
✅
This is already fixed in the master branch.
Fixed in commits:
- https://code.djangoproject.com/changeset/8f6dff372b174e772920de6d82bd085f1a74eaf2
- https://code.djangoproject.com/changeset/35c2a14a49ac3cb25dcff818b280bf0b4c290287
You can install it until a proper release is built:
pip install https://github.com/django/django/zipball/master
Test:
models.py
from django.db import models
from django.contrib.auth.models import User
class Test(models.Model):
user = models.OneToOneField(User)
Results
[__env] $ ./manage.py makemigrations
Migrations for 'data':
0001_initial.py:
- Create model Test
[__env] $ ./manage.py migrate
Operations to perform:
Synchronize unmigrated apps: admin, contenttypes, auth, sessions
(... ommited ...)
Running migrations:
Applying data.0001_initial... OK
3👍
I read the comment above as suggesting adding only the last line in the dependencies list (('contenttypes',' __first__'))
, but I had to add the last two to correct the problem. This might be obvious to those with a better understanding of the makemigrations
tool in Django, but I am new to it and it was not to me.
My last migrations file dependencies list that was originally giving the same error…
dependencies = [
('myapp', '0006_auto_20150209_0324'),
(b'auth', b'__first__'),
(b'contenttypes', b'__first__'),
]
- Django: Best Way to Add Javascript to Custom Widgets
- How to test django caching?
- Django: Generate new CSRF token per request/form
2👍
I’ve found another solution that also work fine.
See the solution of by rockallite.wulf@
https://code.djangoproject.com/ticket/22488
Just add the corresponding dependency in the migration file, like this:
dependencies = [ (b'advperm', b'0001_initial'), (b'auth', b'__first__'), (b'contenttypes', b'__first__'), # Add this line ]
👤aul
Source:stackexchange.com