Skip to content

Commit

Permalink
Changes to work with Django >= 1.8 (#376)
Browse files Browse the repository at this point in the history
* Changes to work with Django >= 1.8

* Limit to Django v 1.x

* Trying to fix Travis errors

* (still) Trying to fix Travis errors

* Stop testing against Python 3.5
  • Loading branch information
apdavison authored Jun 7, 2020
1 parent 99503e2 commit 3df9bca
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: python
sudo: required
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
env:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Requirements
============

Sumatra requires Python versions 2.7, 3.4, 3.5 or 3.6. The web interface requires
Django (>= 1.6 < 1.9) and the django-tagging package.
Django (>= 1.8) and the django-tagging package.
Sumatra requires that you keep your own code in a version control
system (currently Subversion, Mercurial, Git and Bazaar are supported). If you
are already using Bazaar there is nothing else to install. If you
Expand Down
2 changes: 0 additions & 2 deletions ci/requirements-3.4.txt

This file was deleted.

2 changes: 0 additions & 2 deletions ci/requirements-3.5.txt

This file was deleted.

2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base requirements for running Sumatra, for all supported versions of Python
Django>=1.6, <1.9
Django>=1.8
django-tagging>=0.4
httplib2
jinja2
Expand Down
2 changes: 1 addition & 1 deletion doc/developers_guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Requirements
------------

* Python_ 2.7, 3.4, 3.5 or 3.6
* Django_ >= 1.6 < 1.9
* Django_ >= 1.8
* django-tagging_ >= 0.3
* parameters >= 0.2.1
* nose_ >= 0.11.4
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Installing Django
-----------------

If you wish to use the web interface, you will also need to install Django_
version 1.6 or later. On Linux, you may be able to do this via your package
version 1.8 or later. On Linux, you may be able to do this via your package
management system: see https://code.djangoproject.com/wiki/Distributions.

Otherwise, it is very easy to install manually: see
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_tip_revision(self, path=os.getcwd()):
return repo.head.commit.hexsha[:7]


install_requires = ['Django>=1.6, <1.9', 'django-tagging', 'httplib2',
install_requires = ['Django>=1.8, <2', 'django-tagging', 'httplib2',
'docutils', 'jinja2', 'parameters', 'future']
major_python_version, minor_python_version, _, _, _ = sys.version_info
if major_python_version < 3 or (major_python_version == 3 and minor_python_version < 4):
Expand Down
5 changes: 1 addition & 4 deletions sumatra/recordstore/django_store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ def _create_databases(self):
db_file = db['NAME']
if not os.path.exists(os.path.dirname(db_file)):
os.makedirs(os.path.dirname(db_file))
try:
management.call_command('migrate', database=label, verbosity=0)
except django.core.management.base.CommandError:
management.call_command('syncdb', database=label, verbosity=0)
management.call_command('migrate', run_syncdb=True, database=label, verbosity=0, interactive=False)

def configure(self):
settings = django_conf.settings
Expand Down
4 changes: 2 additions & 2 deletions sumatra/recordstore/django_store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_or_create_from_sumatra_object(self, obj, using='default'):
# might be better to specify the list of field names explicitly
# as an argument to the Manager __init__().
excluded_fields = ('id', 'record', 'input_to_records', 'output_from_record', 'output_from_record_id')
field_names = set(self.model._meta.get_all_field_names()).difference(excluded_fields)
field_names = set([f.name for f in self.model._meta.get_fields()]).difference(excluded_fields)
attributes = {}
for name in field_names:
if name == 'metadata':
Expand Down Expand Up @@ -61,7 +61,7 @@ class Meta(object):
abstract = True

def field_names(self):
field_names = self._meta.get_all_field_names()
field_names = [f.name for f in self._meta.get_fields()]
field_names.remove('id')
field_names.remove('record')
return field_names
Expand Down

0 comments on commit 3df9bca

Please sign in to comment.