[damned-lies] Updated code for Django >= 1.7



commit 1d6b1604d3ac7d2b288a8964a81b0b9ad3f1412c
Author: Claude Paroz <claude 2xlibre net>
Date:   Wed Sep 9 16:50:54 2015 +0200

    Updated code for Django >= 1.7

 README                  |   16 +++++-----------
 common/fields.py        |    9 ---------
 damnedlies/settings.py  |    1 -
 people/tests.py         |    4 ++--
 requirements.txt        |    3 +--
 vertimus/models.py      |    2 +-
 vertimus/tests/tests.py |    2 +-
 7 files changed, 10 insertions(+), 27 deletions(-)
---
diff --git a/README b/README
index b837a51..d1adf86 100644
--- a/README
+++ b/README
@@ -8,7 +8,7 @@ You can find the Data model in the /docs directory.
 Requirements
 ============
 
-1 - Django 1.6.X
+1 - Django > 1.7.X
 
 2 - Python 2.6 (minimal)
     PIL (python-imaging) or pillow for hackergotchi checks.
@@ -16,22 +16,16 @@ Requirements
 
 3 - gettext, intltool, gnome-doc-utils (for stats generation), itstool
 
-4 - South >= 0.7 - http://south.aeracode.org/
-    South is a Django extension that allows you to track changes in your models
-    over time, and to update the database to reflect those changes.
-
-    See http://south.aeracode.org/wiki/Download for installation instructions
-
-5 - [Optional] Django Debug Toolbar
+4 - [Optional] Django Debug Toolbar
     git clone git://github.com/dcramer/django-debug-toolbar.git
     Define USE_DEBUG_TOOLBAR to True in local_settings.py to use it.
 
-6 - [Optional] python-openid and django-openid-auth (see OpenID support
+5 - [Optional] python-openid and django-openid-auth (see OpenID support
     below).
 
-7 - [Optional] python-pyicu for correct sorting in various languages
+6 - [Optional] python-pyicu for correct sorting in various languages
 
-8 - [Optional] translate-toolkit >= 1.9.0-beta2 (--keeptranslations option for
+7 - [Optional] translate-toolkit >= 1.9.0-beta2 (--keeptranslations option for
     pogrep) for reduced po files.
 
 Installing all requirements using pip:
diff --git a/common/fields.py b/common/fields.py
index 960d063..f304dc3 100644
--- a/common/fields.py
+++ b/common/fields.py
@@ -90,12 +90,3 @@ class JSONField(models.TextField):
 
     def value_to_string(self, obj):
         return json.dumps(self._get_val_from_obj(obj), cls=DjangoJSONEncoder)
-
-
-# rules for South migrations tool (for version >= 0.7)
-try:
-    from south.modelsinspector import add_introspection_rules
-    add_introspection_rules([], ["^common\.fields\.DictionaryField"])
-    add_introspection_rules([], ["^common\.fields\.JSONField"])
-except ImportError:
-    pass
diff --git a/damnedlies/settings.py b/damnedlies/settings.py
index 9433e85..e0f27a1 100644
--- a/damnedlies/settings.py
+++ b/damnedlies/settings.py
@@ -133,7 +133,6 @@ INSTALLED_APPS = (
     'django.contrib.humanize',
     'django.contrib.messages',
     'django.contrib.staticfiles',
-    'south',
     'common',
     'languages',
     'people',
diff --git a/people/tests.py b/people/tests.py
index d331850..941b0d1 100644
--- a/people/tests.py
+++ b/people/tests.py
@@ -123,7 +123,7 @@ class PeopleTestCase(TestCase):
     def test_all_languages_list_order(self):
         """
         The order of the languages should be case insensitive.
-        This tests that "français" appears before "Frisian".
+        This tests that "français" appears before "Gaeilge".
         """
         Person.objects.create(username='jn', password='password')
         self.client.login(username='jn', password='password')
@@ -131,7 +131,7 @@ class PeopleTestCase(TestCase):
         response = self.client.get(url)
         all_languages = response.context['all_languages']
         self.assertGreater(
-            all_languages.index(('fy-nl', 'Frisian')),
+            all_languages.index(('ga', 'Gaeilge')),
             all_languages.index(('fr', "français")),
             "français is not before Frisian"
         )
diff --git a/requirements.txt b/requirements.txt
index e85a1e2..a0d6e25 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,4 @@
-django>=1.6,<1.7
-south>=1.0
+django>=1.7
 django-debug-toolbar
 markdown
 pyicu
diff --git a/vertimus/models.py b/vertimus/models.py
index 8283174..c4f0262 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -445,7 +445,7 @@ class Action(ActionAbstract):
         super(Action, self).save(*args, **kwargs)
 
     def apply_on(self, state, form_data):
-        if not self in state.get_available_actions(self.person):
+        if not self.name in [a.name for a in state.get_available_actions(self.person)]:
             raise Exception('Not allowed')
         self.state_db = state
         if self.file:
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 084470e..216e4c3 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -502,7 +502,7 @@ class VertimusTest(TeamsAndRolesTests):
 
         # For an archived module, the only available action is to archive the state by a coord.
         self.assertEqual(state.get_available_actions(self.pt), [])
-        self.assertEqual(state.get_available_actions(self.pcoo), [ActionAA()])
+        self.assertEqual([a.name for a in state.get_available_actions(self.pcoo)], ['AA'])
 
         action = Action.new_by_name('AA', person=self.pcoo)
         action.apply_on(state, {'send_to_ml': False})


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]