can not import name commit_on_success, Mockups in django 1.9

1

I installed Mockups in django 1.9, initially I sent the error: ImportError for import_module and I solved it with: link now I get another import error:

File "/home/alejandro/django190/local/lib/python2.7/site-packages/mockups/management/commands/mockups.py", line 30, in <module>
from django.db.transaction import commit_on_success ImportError: cannot import name commit_on_success

how to correct it ?, thanks

    
asked by Alex Ancco Cahuana 31.08.2016 в 04:57
source

2 answers

0

I have solved it, guiding me with this post link

replace @commit_on_success with @atomic online 120 approx and more or less down line 122 replace from django.db.models import get_model by:

 try:
        from django.apps import apps
        get_model = apps.get_model
    except ImportError:
        # Support django < 1.8
        from django.db.models import get_model

my imports stayed that way

from importlib import import_module
from django.db.transaction import atomic

in case the file in my case is inside the virtualenv and mockups.py is in the directori

django190/lib/python2.7/site-packages/mockups/management/commands/mockups.py
    
answered by 31.08.2016 / 23:26
source
1

commit_on_success was removed and replaced with atomic in 1.6 (or 1.7 / 8 I do not remember).

Your example indicates that mockups.py is not up to date. In mockups.py try to change from django.db.transaction import commit_on_success to from django.db.transaction import atomic .

    
answered by 31.08.2016 в 15:06