Skip to content

Commit

Permalink
Merge df67a49 into 2bbb2ae
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Mar 6, 2023
2 parents 2bbb2ae + df67a49 commit 6726638
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 22 deletions.
8 changes: 8 additions & 0 deletions changelog.md
@@ -1,3 +1,11 @@
### 0.24.0 (Major Release)

#### Updates to the Dependency Graph

* Django: 2.2.16 -> 3.2
* Django-compressor: 2.4 -> 3.0
* django-reversion: 3.0.8 -> 4.0.2

### 0.23.0 (Major Release)

#### Enhanced customisation of search results
Expand Down
20 changes: 15 additions & 5 deletions doc/docs/reference/upgrading.md
Expand Up @@ -3,14 +3,24 @@
This document provides instructions for specific steps required to upgrading your Opal
application to a later version where there are extra steps required.

#### 0.23.0 -> v0.24.0

Django is upgraded to 3.2 as part of this,
* `{% load staticfiles %}` in templates needs to be replaced with `{% load static %}`
* Third part json field libraries should be replaced with the jsonfield that now ships with django
* `DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'` should be set in your settings

Note NullBooleanField is deprecated and should be replaced with BooleanField(null=True).
NullBooleanField will be removed when opal upgrades to django 4.

#### v0.20.0 -> v0.21.0

Opal no longer supports Python 3.5.
Opal no longer supports Python 3.5.
You will need to use 3.6, 3.7 or 3.8 and therefore must make sure they are installed in your environment.

#### Celery changes

Opal does not require you to run Celery but we do pre-configure Opal applications for use with
Opal does not require you to run Celery but we do pre-configure Opal applications for use with
Celery.

If you don't have `celery` or `django-celery` in your requirements.txt this section can be ignored.
Expand All @@ -19,7 +29,7 @@ If you don't have `celery` or `django-celery` in your requirements.txt this sect

__Note__ This means that old results from `django-celery` will no longer be visible from the admin.

`django-celery-results==2.0.0` replaces `django-celery`, please add it to your requirements.
`django-celery-results==2.0.0` replaces `django-celery`, please add it to your requirements.
This will show Celery task results in the admin and requires `python manage.py migrate` to be run.

Celery has been upgraded to 5.0.2.
Expand Down Expand Up @@ -72,8 +82,8 @@ you have specified them in for instance, a requirements.txt.

##### API API Changes (REST Framework)

Note that the Django REST Framework update includes a breaking change to their public
API which may affect your application. The `base_name` attribute of a ViewSet has been
Note that the Django REST Framework update includes a breaking change to their public
API which may affect your application. The `base_name` attribute of a ViewSet has been
renamed to `basename` ([release notes](https://www.django-rest-framework.org/community/release-notes/#390)).

Any APIs implemented in your application will likely need to rename this attribute as
Expand Down
2 changes: 1 addition & 1 deletion opal/_version.py
@@ -1,4 +1,4 @@
"""
Declare our current version string
"""
__version__ = '0.23.1'
__version__ = '0.24.0'
2 changes: 1 addition & 1 deletion opal/context_processors.py
Expand Up @@ -17,7 +17,7 @@ def settings(request):
"""
Put all settings in locals() for our templte context.
"""
return {x: getattr(s, x) for x in dir(s)}
return {x: getattr(s, x) for x in dir(s) if hasattr(s, x)}


def models(request):
Expand Down
2 changes: 1 addition & 1 deletion opal/models.py
Expand Up @@ -87,7 +87,7 @@ def m2m(x):
def _get_field_type(cls, name):
try:
return type(cls._meta.get_field(name))
except models.FieldDoesNotExist:
except FieldDoesNotExist:
pass

# TODO: Make this dynamic
Expand Down
2 changes: 1 addition & 1 deletion opal/scaffolding/plugin_scaffold/requirements.txt.jinja2
@@ -1,4 +1,4 @@
python-dateutil==2.8.1
django-compressor==2.4
django-compressor==3.0
opal=={{ version }}
coverage==3.6
2 changes: 2 additions & 0 deletions opal/scaffolding/scaffold/app/settings.py.jinja2
Expand Up @@ -118,6 +118,8 @@ except ImportError:
}
}

DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'

# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
Expand Down
6 changes: 3 additions & 3 deletions opal/scaffolding/scaffold/requirements.txt.jinja2
@@ -1,16 +1,16 @@
# cryptography is required for heroku deployment
coverage==3.6
django==2.2.16
Django==3.2.15
dj-database-url==0.2.1
gunicorn==0.17.4
psycopg2==2.8.6
dj-static==0.0.6
django-reversion==3.0.1
django-reversion==4.0.2
#django-axes==1.4.0
ffs==0.0.8.2
requests==2.25.0
djangorestframework==3.12.2
django-compressor==2.4
django-compressor==3.0
python-dateutil==2.8.1
django-celery-results==2.0.0
celery==5.0.2
Expand Down
4 changes: 2 additions & 2 deletions opal/templates/base.html
@@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
{% load compress %}
{% load application %}
{% load plugins %}
Expand Down Expand Up @@ -88,7 +88,7 @@ <h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>

</head>
<body>
{% block application %}{% endblock %}
{% block application %}{% endblock %}
<!-- google analytics -->
{% block analytics %}
<script>
Expand Down
2 changes: 1 addition & 1 deletion opal/templates/plugins/javascripts.html
@@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
{% for js in javascripts %}
<script type="text/javascript" src="{% static js %}"></script>
{% endfor %}
2 changes: 1 addition & 1 deletion opal/templates/plugins/stylesheets.html
@@ -1,4 +1,4 @@
{% load staticfiles %}
{% load static %}
{% for sheet, mime_type in styles %}
<link href="{% static sheet %}" type="{{ mime_type }}" rel="stylesheet" charset="utf-8" media="all">
{% endfor %}
3 changes: 2 additions & 1 deletion opal/tests/test_context_processors.py
Expand Up @@ -14,7 +14,8 @@ def test_settings(self):
context = context_processors.settings(None)

for s in dir(settings):
self.assertEqual(getattr(settings, s), context[s])
if hasattr(settings, s):
self.assertEqual(getattr(settings, s), context[s])


class ModelsTestCase(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions opal/tests/test_models.py
Expand Up @@ -21,7 +21,7 @@
FamousLastWords, PatientColour, ExternalSubRecord, SymptomComplex,
PatientConsultation, Birthday, DogOwner, HatWearer, InvisibleHatWearer,
HouseOwner, HoundOwner, Colour, FavouriteColour, Dinner,
EntitledHatWearer
EntitledHatWearer, Demographics
)


Expand Down Expand Up @@ -814,7 +814,7 @@ def test_field_schema(self, patient_list):

class AbstractDemographicsTestCase(OpalTestCase):
def test_name(self):
d = models.Demographics(first_name='Jane',
d = Demographics(first_name='Jane',
surname='Doe',
middle_name='Obsidian')
self.assertEqual('Jane Doe', d.name)
Expand Down
2 changes: 2 additions & 0 deletions runtests.py
Expand Up @@ -19,6 +19,8 @@
},
PROJECT_PATH=PROJECT_PATH,
ROOT_URLCONF='opal.urls',
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField',
SECRET_KEY='1111',
USE_TZ=True,
OPAL_EXTRA_APPLICATION='',
DATE_FORMAT='d/m/Y',
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Expand Up @@ -49,11 +49,11 @@
'kombu==5.1.0',
'ffs>=0.0.8.2',
'Jinja2==2.10.1',
'django==2.2.16',
'Django==3.2.15',
'requests==2.25.0',
'djangorestframework==3.12.2',
'django-reversion==3.0.8',
'django-compressor==2.4',
'django-reversion==4.0.2',
'django-compressor==3.0',
'python-dateutil==2.8.1',
'django-celery-results==2.0.0',
'celery==5.0.2',
Expand Down

0 comments on commit 6726638

Please sign in to comment.