diff options
author | Teddy Wing | 2014-04-21 19:07:23 -0400 |
---|---|---|
committer | Teddy Wing | 2014-04-21 19:08:33 -0400 |
commit | 538d8ca648ba8861fad0e110570e9509cd635820 (patch) | |
tree | 4fc93dd23f3be480eb4133eb0eae2975523f42ae | |
parent | d1ca9e8c99345df328e7f9986c9a89438a1b6534 (diff) | |
download | django-sneak-peek-538d8ca648ba8861fad0e110570e9509cd635820.tar.bz2 |
Use `create` instead of `get_or_create` because of a sqlite3
transaction error I was getting using Django 1.6.2.
Error output:
"Your database backend doesn't behave properly when "
django.db.transaction.TransactionManagementError:
Your database backend doesn't behave properly when autocommit is off.
Turn it on before using 'atomic'.
-rw-r--r-- | sneak_peek_tag/migrations/0001_add_permission_sneak_peek.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sneak_peek_tag/migrations/0001_add_permission_sneak_peek.py b/sneak_peek_tag/migrations/0001_add_permission_sneak_peek.py index faf5398..e268398 100644 --- a/sneak_peek_tag/migrations/0001_add_permission_sneak_peek.py +++ b/sneak_peek_tag/migrations/0001_add_permission_sneak_peek.py @@ -7,12 +7,12 @@ from django.db import models class Migration(DataMigration): def forwards(self, orm): - content_type, c = \ - orm['contenttypes.ContentType'].objects.get_or_create( + content_type = \ + orm['contenttypes.ContentType'].objects.create( name='sneak peek permission', app_label='sneak_peek_tag') - orm['auth.Permission'].objects.get_or_create( + orm['auth.Permission'].objects.create( name='can view sneak peek', content_type=content_type, codename='can_view_sneak_peek') |