When I make the migrations using python manage.py migrate manage (yes it's Django 1.8 and I can't change it :/), the migrations (every single one I tested) always fail with the same error :
django.db.transaction.TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK
Here is the code from the migration file :
class Migration(SchemaMigration):
def forwards(self, orm):
# Check expiry keys in Organization
for org in Organization.objects.all():
self.checkExpiryDate(org)
# Check expiry keys in UserProfileRoleInOrganization
for uprio in UserProfileRoleInOrganization.objects.all():
self.checkExpiryDate(uprio)
def checkExpiryDate(self, entity):
# Check if expiry_date is consistent with apikey and fix it if necessary
if not entity.date_has_changed:
return
date_in_key = entity.getExpiryDateInKey()
if not date_in_key:
return
y = int(date_in_key[:4])
m = int(date_in_key[4:-2])
d = int(date_in_key[-2:])
entity.expiry_date = datetime.datetime(y,m,d)
entity.save()
def backwards(self, orm):
pass
I've seen some answers to other similar questions but no, I don't have any @commit.... decorator in my code.
May somebody help me please ?

Delete the migrations folder and re run migrations ./manage.py makemigrations app ./manage.py migrate
or
You also can fake the migrations and reset it