# compat/db.py
from django.db import transaction
if django.VERSION < (1, 6):
atomic_compat_transaction = transaction.commit_on_success
else:
atomic_compat_transaction = transaction.atomic
# your_app/views.py
from compat.db import atomic_compat_transaction
@atomic_compat_transaction
def your_view(request):
# Your view code here
# compat/fields.py
if django.VERSION < (1, 8):
ALL_FIELDS = None
else:
ALL_FIELDS = '__all__'
# your_app/forms.py
from compat.fields import ALL_FIELDS
class YourForm(forms.ModelForm):
class Meta:
model = YourModel
fields = ALL_FIELDS
'deprecated_transaction_system': {
'message': 'Transaction management has been completely changed. atomic is replacing old commit_on_success and other utils.',
'regex': r'.*(((@|with\s)transaction\.(commit_on_success|commit_manually))).*',
'number': '1603'
},
$ ./manage.py check_deprecated_rules
./my_app/views.py
1603: Transaction management has been completely changed.
atomic is replacing old commit_on_success and other utils.
L204: @transaction.commit_on_success
$ ./manage.py check_deprecated_rules
./mon_app/models.py
1601: models.BooleanField has to be initialised with default
parameter, as implicit default has changed between
Django 1.4 (False) and 1.6 (None).
L192: is_active = models.BooleanField()
$ ./manage.py diff_migrations
Migrations diff:
{'your_app': ['0001_initial.py', '0002_add_new_field']}