Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6712c8e
Bumping all requirements to be up-to-date
adamcharnock Jan 9, 2021
9135e99
Removing all python 2 compat imports, which are largely gone from dja…
adamcharnock Jan 9, 2021
56ec7a9
Fixing RemovedInDjango40Warning: Simple replace of force_text() -> fo…
adamcharnock Jan 9, 2021
a931702
Fixing DRF MigrationNotice. filter_class -> filterset_class
adamcharnock Jan 9, 2021
c85cba8
Fixing RemovedInDjango40Warning. url -> re_path
adamcharnock Jan 9, 2021
b79e967
Fixing RemovedInDjango40Warning. ugettext_lazy -> gettext_lazy
adamcharnock Jan 9, 2021
2f48782
Fixing RemovedInDjango40Warning. url -> re_path (second round of …
adamcharnock Jan 9, 2021
e5a7f75
The staticfiles template tag library has been renamed to static. Upda…
adamcharnock Jan 9, 2021
b873771
Specifying `algorithms` param to jwt.decode()
adamcharnock Jan 9, 2021
cd0289c
fail_code was too short for its choices, which is a fatal error in dj…
adamcharnock Jan 9, 2021
5045e38
Removing third-party use of json field as it is now bundled with django
adamcharnock Jan 9, 2021
56cb974
Fixing mutable default values for JSONField
adamcharnock Jan 9, 2021
0974aa7
Fixing deprecation warning: NullBooleanField -> BooleanField
adamcharnock Jan 9, 2021
e006d1a
Fixing warning regarding missing template context processor:
adamcharnock Jan 9, 2021
818649d
Adding the BooleanField and JSONField migration which I missed in an …
adamcharnock Jan 9, 2021
f6fadb8
Fixing comparison error in tests. This could probably be done better
adamcharnock Jan 9, 2021
19c3b92
Proforma resource now returning JSON objects rather than stringified …
adamcharnock Jan 9, 2021
3bcb5ca
DeprecationWarning fix: assertEquals -> assertEqual
adamcharnock Jan 9, 2021
792e0f9
Fixing malformatted requirements files
adamcharnock Jan 10, 2021
af0104d
Fixing pep8 issues
adamcharnock Jan 10, 2021
e77477b
Creating separate urls py to be used when running silver as a standal…
adamcharnock Jan 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Changelog

## Unrealeased changes
_Nothing yet_

- Adding Django 3 support
- Updating all dependencies to latest versions
- Dropping Python 2 compatibility
- Proforma API fields `archived_provider` and `archived_customer` now correctly return JSON objects rather than
stringified JSON objects


## 0.10.1
Fixed issue in autocomplete views where user.is_authenticated is no longer a function call and instead an attribute

Expand Down
37 changes: 18 additions & 19 deletions requirements/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,31 @@
# UNMAINTAINED means the package owner is no longer maintaining it

# Core
Django>=1.11,<2.3 # ----------------------------------------------------------- (bumped 2019-05-28)
sqlparse>=0.2,<0.3 # (required for some old migrations) ----------------------- (bumped 2018-06-07)
Django~=3.1.5
sqlparse~=0.4.1 # (required for some old migrations)

# Django Utils
django-fsm>=2.3,<2.7 # -------------------------------------------------------- (bumped 2018-06-07)
django-filter>=1.1,<2.1 # ----------------------------------------------------- (bumped 2019-01-31)
django-livefield>=2.8,<3.3 # -------------------------------------------------- (bumped 2019-06-10)
django-jsonfield==1.0.1 # ---------------------------------------------------- (checked 2018-06-07)
django-model-utils>=3.0,<3.2 # ------------------------------------------------ (bumped 2018-06-07)
django-annoying>=0.10,<0.11 # (various Django helpers) ------------------------ (bumped 2018-06-07)
django-autocomplete-light>=3.2,<3.3 # ----------------------------------------- (bumped 2018-06-07)
django-fsm~=2.7.1
django-filter~=2.4.0
django-livefield~=3.3.0
django-model-utils~=4.1.1
django-annoying~=0.10.6
django-autocomplete-light~=3.8.1

# API
djangorestframework>=3.8,<3.10 # ---------------------------------------------- (bumped 2019-01-31)
djangorestframework-bulk<0.3 # ----------------------------------------------- (checked 2018-06-07)
djangorestframework~=3.12.2
djangorestframework-bulk~=0.2.1

# I18n
pycountry>=16.11.08 # --------------------------------------------------------- (bumped 2018-06-07)
python-dateutil>=2.6,<2.8 # --------------------------------------------------- (bumped 2018-06-07)
pyvat>=1.3,<1.4 # ------------------------------------------------------------- (bumped 2018-06-07)
pycountry~=20.7.3
python-dateutil~=2.8.1
pyvat~=1.3.13

# Crypto
cryptography>=1.9,<2.4 # ------------------------------------------------------ (bumped 2018-11-02)
PyJWT>=1.5,<1.7 # ------------------------------------------------------------- (bumped 2018-06-07)
cryptography~=3.3.1
PyJWT~=2.0.0

# Other
furl>=1,<1.3 # (URL parsing and manipulation) --------------------------------- (bumped 2018-08-10)
xhtml2pdf>=0.2,<0.3 # (PDF rendering, python-dev is required) ----------------- (bumped 2018-06-07)
PyPDF2>=1.26,<2 # (PDF manipulation) ------------------------------------------ (bumped 2018-06-07)
furl~=2.1.0
xhtml2pdf~=0.2.5
PyPDF2~=1.26.0
6 changes: 3 additions & 3 deletions requirements/optionals.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
celery>=4.0,<4.2 # ------------------------------------------------------------ (bumped 2018-06-07)
redis>=2.10,<2.11 # ----------------------------------------------------------- (bumped 2018-06-07)
celery-once>=1.2,<2.1 # ------------------------------------------------------- (bumped 2018-06-07)
celery~=5.0.5
redis~=3.5.3
celery_once~=3.0.1
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ flake8==2.4.1
freezegun==0.3.8
coverage==3.7.1
django-coverage==1.2.4
pytest==3.6.4
pytest-django==3.4.5
pytest==5.4.0
pytest-django==4.1.0
factory-boy==2.5.2
pep8==1.7.0
Faker==0.7.17
5 changes: 3 additions & 2 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

INSTALLED_APPS = EXTERNAL_APPS + INTERNAL_APPS

ROOT_URLCONF = 'silver.urls'
ROOT_URLCONF = 'silver.urls_project'
PROJECT_ROOT = os.path.dirname(__file__)

FIXTURE_DIRS = (
Expand All @@ -92,7 +92,8 @@
"django.template.context_processors.media",
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages"
"django.template.context_processors.request",
"django.contrib.messages.context_processors.messages",
)
}
}
Expand Down
10 changes: 5 additions & 5 deletions silver/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
from django.shortcuts import render
from django.urls import reverse
from django.utils import timezone
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.html import escape, conditional_escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from silver.documents_generator import DocumentsGenerator
from silver.models import (
Expand Down Expand Up @@ -284,7 +284,7 @@ def perform_action(self, request, action, queryset):
user_id=request.user.id,
content_type_id=ContentType.objects.get_for_model(entry).pk,
object_id=entry.id,
object_repr=force_text(entry),
object_repr=force_str(entry),
action_flag=CHANGE,
change_message='{action} action initiated by user.'.format(
action=action.replace('_', ' ').strip().capitalize()
Expand Down Expand Up @@ -778,7 +778,7 @@ def _call_method_on_queryset(self, request, method, queryset, action):
user_id=request.user.id,
content_type_id=ContentType.objects.get_for_model(document).pk,
object_id=document.id,
object_repr=force_text(document),
object_repr=force_str(document),
action_flag=CHANGE,
change_message='{action} action initiated by user.'.format(
action=action.replace('_', ' ').strip().capitalize()
Expand All @@ -788,7 +788,7 @@ def _call_method_on_queryset(self, request, method, queryset, action):
results[document]['result'] = mark_safe(error)
results[document]['success'] = False
except ValueError as error:
results[document]['result'] = force_text(error)
results[document]['result'] = force_str(error)
results[document]['success'] = False
except AttributeError:
results[document]['success'] = False
Expand Down
3 changes: 2 additions & 1 deletion silver/api/serializers/billing_entities_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import absolute_import

from django.core.serializers.json import DjangoJSONEncoder
from rest_framework import serializers
from rest_framework.fields import JSONField
from rest_framework.relations import HyperlinkedRelatedField
Expand Down Expand Up @@ -85,7 +86,7 @@ class CustomerSerializer(serializers.HyperlinkedModelSerializer):
view_name='transaction-list', source='*',
lookup_url_kwarg='customer_pk'
)
meta = JSONField(required=False)
meta = JSONField(required=False, encoder=DjangoJSONEncoder)
url = CustomerUrl(view_name='customer-detail', read_only=True, source='*')

class Meta:
Expand Down
5 changes: 3 additions & 2 deletions silver/api/serializers/documents_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import absolute_import

from django.core.serializers.json import DjangoJSONEncoder
from rest_framework import serializers
from rest_framework.fields import JSONField, DecimalField

Expand Down Expand Up @@ -117,8 +118,8 @@ class InvoiceSerializer(AutoCleanSerializerMixin,
customer = CustomerUrl(view_name='customer-detail',
queryset=Customer.objects.all())
transactions = TransactionSerializer(many=True, read_only=True)
archived_customer = JSONField(read_only=True)
archived_provider = JSONField(read_only=True)
archived_customer = JSONField(read_only=True, encoder=DjangoJSONEncoder)
archived_provider = JSONField(read_only=True, encoder=DjangoJSONEncoder)
total_in_transaction_currency = serializers.DecimalField(
max_digits=None, decimal_places=2, coerce_to_string=True, read_only=True,
)
Expand Down
3 changes: 2 additions & 1 deletion silver/api/serializers/subscriptions_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from __future__ import absolute_import

from django.core.serializers.json import DjangoJSONEncoder
from rest_framework import serializers
from rest_framework.fields import JSONField
from rest_framework.reverse import reverse
Expand Down Expand Up @@ -67,7 +68,7 @@ class SubscriptionSerializer(serializers.HyperlinkedModelSerializer):
url = SubscriptionUrl(view_name='subscription-detail', source='*',
queryset=Subscription.objects.all(), required=False)
updateable_buckets = serializers.ReadOnlyField()
meta = JSONField(required=False)
meta = JSONField(required=False, encoder=DjangoJSONEncoder)

class Meta:
model = Subscription
Expand Down
3 changes: 2 additions & 1 deletion silver/api/serializers/transaction_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def get_url(self, obj, view_name, request, format):
def get_object(self, view_name, view_args, view_kwargs):
try:
transaction_uuid = jwt.decode(view_kwargs['token'],
settings.PAYMENT_METHOD_SECRET)['transaction']
settings.PAYMENT_METHOD_SECRET,
algorithms=['HS256'])['transaction']
return self.queryset.get(uuid=transaction_uuid)
except (jwt.ExpiredSignatureError, jwt.DecodeError, jwt.InvalidTokenError):
return None
Expand Down
Loading