dominno / django-moderation

django-moderation is reusable application for Django framework, that allows to moderate any model objects.
BSD 3-Clause "New" or "Revised" License
269 stars 91 forks source link

Django 1.6 Support #103

Closed SamTShaw closed 10 years ago

SamTShaw commented 10 years ago

Fix some of the incompatible changes between Django 1.3 and 1.6 Maintain unit test backwards compatibility

Default.py imports - fix imports to look at new location

moderation/managers MetaClass needs to inherit from type(django.db.models.manager.Manager) instead of type. This is a Django 1.6 change. See https://stackoverflow.com/questions/21193720/what-happened-in-the-django-1-6-branch-that-affected-how-manager-metaclasses-wor for details

Since Django 1.6 each test is wrapped in a transaction, so if an exception occurs, the transaction is broken and you need to rollback manually. The solution is to wrap the exception code with transaction.atomic(). In those test cases, check that transaction has the 'atomic' attr - if it does use it.

CustomUser extends User instead of AbstractUser in the test models.

Update ModerationAdmin.get_form so that the function prototype matches the super. It was causing problems with 'fields' kwarg missing

Test configs: Add Django 1.6.5 to travis Update Django 1.3 to 1.3.7 Add django1.6 targets to tox

dominno commented 10 years ago

Hi @Moustacha I merged your PR. Just found that flakes gives some error and travis build is not working. Could you fix this also, please ?

The command "flake8 --exclude=migrations --ignore=W291,F403 moderation tests" failed and exited with 1 during .