diff --git a/README b/README index 539766b..eb38ced 100644 --- a/README +++ b/README @@ -12,19 +12,19 @@ Setup In order to make use of this application you will need: * Python 3.4+ -* Django 1.6.x - tested with 1.6.10; newer versions may work, but - the application has not been tested with 1.7 or newer. +* Django 1.8.x - tested with 1.8.13; newer versions may work, but + the application has not been tested with 1.9 or newer. * For production usage, a web server set up to host Django applications (not needed for local-only testing) * A database supported by Django (SQLite, MySQL, etc.). Django takes care of creating the database itself, you just need to ensure that the database server (if not using SQLite) is configured and running. * The following third-party Django modules (tested versions listed): - * django-registration (1.0) - * django-reversion (1.8.7) - * django-reversion-compare (0.4.0) + * django-registration (2.1) + * django-reversion (1.9.3) + * django-reversion-compare (0.5.6) * django-simple-captcha (0.4.6) - * django-nvd3 (0.9.7) + * django-nvd3 (0.14.2) * djangorestframework (3.2.5) * django-cors-headers (1.1.0) * On the machine that will run the backend update script (which does not diff --git a/layerindex/forms.py b/layerindex/forms.py index e15dbeb..0e7902d 100644 --- a/layerindex/forms.py +++ b/layerindex/forms.py @@ -4,6 +4,7 @@ # # Licensed under the MIT license, see COPYING.MIT for details +from collections import OrderedDict from layerindex.models import LayerItem, LayerBranch, LayerMaintainer, LayerNote, RecipeChangeset, RecipeChange, ClassicRecipe from django import forms from django.core.validators import URLValidator, RegexValidator, EmailValidator @@ -66,10 +67,14 @@ class EditLayerForm(forms.ModelForm): if user.is_authenticated(): del self.fields['captcha'] # Ensure repo subdir appears after repo URL - field_order = self.fields.keyOrder + field_order = list(self.fields.keys()) field_order.pop(field_order.index('vcs_subdir')) name_pos = field_order.index('vcs_url') + 1 field_order.insert(name_pos, 'vcs_subdir') + new_fields = OrderedDict() + for field in field_order: + new_fields[field] = self.fields[field] + self.fields = new_fields self.fields['vcs_subdir'].initial = layerbranch.vcs_subdir self.was_saved = False diff --git a/layerindex/utils.py b/layerindex/utils.py index 72dc342..50268e0 100644 --- a/layerindex/utils.py +++ b/layerindex/utils.py @@ -53,10 +53,12 @@ def runcmd(cmd, destdir=None, printerr=True, logger=None): return output def setup_django(): + import django # Get access to our Django model newpath = os.path.abspath(os.path.dirname(__file__) + '/..') sys.path.append(newpath) os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' + django.setup() def logger_create(name): logger = logging.getLogger(name) diff --git a/layerindex/views.py b/layerindex/views.py index 62f5268..3f9525d 100644 --- a/layerindex/views.py +++ b/layerindex/views.py @@ -121,7 +121,7 @@ def edit_layer_view(request, template_name, branch='master', slug=None): form = EditLayerForm(request.user, layerbranch, request.POST, instance=layeritem) maintainerformset = LayerMaintainerFormSet(request.POST, instance=layerbranch) if form.is_valid() and maintainerformset.is_valid(): - with transaction.commit_on_success(): + with transaction.atomic(): reset_last_rev = False form.save() layerbranch.layer = layeritem diff --git a/requirements.txt b/requirements.txt index 7fbbfb3..8ec7bf1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -Django==1.6.11 +Django==1.8.13 django-cors-headers==1.1.0 django-nvd3==0.9.7 -django-registration==1.0 -django-reversion==1.8.7 -django-reversion-compare==0.4.0 +django-registration==2.1 +django-reversion==1.9.3 +django-reversion-compare==0.5.6 django-simple-captcha==0.4.6 djangorestframework==3.2.5 gitdb==0.6.4 @@ -11,7 +11,7 @@ GitPython==2.0.5 Jinja2==2.8 MarkupSafe==0.23 mysqlclient==1.3.7 -Pillow==3.2.0 +Pillow==3.3.0 python-nvd3==0.14.2 python-slugify==1.1.4 six==1.10.0