diff --git a/config/urls.py b/config/urls.py index 1dca8b6c..d1d8fd66 100644 --- a/config/urls.py +++ b/config/urls.py @@ -1,7 +1,8 @@ from django.conf import settings -from django.conf.urls import include, url +from django.conf.urls import include from django.contrib import admin from django.http import HttpResponse +from django.urls import re_path from django.views import defaults as default_views from django.views.decorators.cache import cache_control @@ -26,46 +27,46 @@ schema_cache_decorator = cache_control(max_age=schema_cache_timeout) urlpatterns = [ - url(r'^$', - schema_cache_decorator(schema_view.with_ui('swagger', cache_timeout=0)), - name='schema-swagger-ui'), - url(r'^swagger(?P\.json|\.yaml)$', - schema_cache_decorator(schema_view.without_ui(cache_timeout=schema_cache_timeout)), - name='schema-json'), - url(r'^redoc/$', - schema_cache_decorator(schema_view.with_ui('redoc', cache_timeout=schema_cache_timeout)), - name='schema-redoc'), - url(settings.ADMIN_URL, admin.site.urls), - url(r'^api/v1/', include('safe_relay_service.relay.urls', namespace='v1')), - url(r'^api/v2/', include('safe_relay_service.relay.urls_v2', namespace='v2')), - url(r'^api/v3/', include('safe_relay_service.relay.urls_v3', namespace='v3')), - url(r'^check/', lambda request: HttpResponse("Ok"), name='check'), + re_path(r'^$', + schema_cache_decorator(schema_view.with_ui('swagger', cache_timeout=0)), + name='schema-swagger-ui'), + re_path(r'^swagger(?P\.json|\.yaml)$', + schema_cache_decorator(schema_view.without_ui(cache_timeout=schema_cache_timeout)), + name='schema-json'), + re_path(r'^redoc/$', + schema_cache_decorator(schema_view.with_ui('redoc', cache_timeout=schema_cache_timeout)), + name='schema-redoc'), + re_path(settings.ADMIN_URL, admin.site.urls), + re_path(r'^api/v1/', include('safe_relay_service.relay.urls', namespace='v1')), + re_path(r'^api/v2/', include('safe_relay_service.relay.urls_v2', namespace='v2')), + re_path(r'^api/v3/', include('safe_relay_service.relay.urls_v3', namespace='v3')), + re_path(r'^check/', lambda request: HttpResponse("Ok"), name='check'), ] if settings.DEBUG: # This allows the error pages to be debugged during development, just visit # these url in browser to see how these error pages look like. urlpatterns += [ - url( + re_path( r"^400/$", default_views.bad_request, kwargs={"exception": Exception("Bad Request!")}, ), - url( + re_path( r"^403/$", default_views.permission_denied, kwargs={"exception": Exception("Permission Denied")}, ), - url( + re_path( r"^404/$", default_views.page_not_found, kwargs={"exception": Exception("Page not Found")}, ), - url(r"^500/$", default_views.server_error), + re_path(r"^500/$", default_views.server_error), ] if "debug_toolbar" in settings.INSTALLED_APPS: import debug_toolbar - urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns + urlpatterns = [re_path(r"^__debug__/", include(debug_toolbar.urls))] + urlpatterns admin.autodiscover() diff --git a/requirements.txt b/requirements.txt index 22cd2247..a05a8827 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,29 +1,29 @@ -cachetools==4.1.1 -celery==4.4.7 +cachetools==4.2.1 +celery==5.0.5 django-authtools==1.7.0 -django-celery-beat==2.0.0 +django-celery-beat==2.2.0 django-cors-headers==3.5.0 django-debug-toolbar django-debug-toolbar-force django-environ==0.4.5 django-filter==2.4.0 -django-model-utils==4.0.0 +django-model-utils==4.1.1 django-redis==4.12.1 -django-timezone-field==4.0 -django==3.1.2 +django-timezone-field==4.1.1 +django==3.1.6 djangorestframework-camel-case==1.2.0 -djangorestframework==3.11.2 +djangorestframework==3.12.2 docutils==0.16 -drf-yasg[validation]==1.17.1 +drf-yasg[validation]==1.20.0 ethereum==2.3.2 -gnosis-py==2.6.9 +gnosis-py==2.7.6 gunicorn[gevent]==20.0.4 hexbytes==0.2.1 -lxml==4.5.2 -numpy==1.19.2 -packaging==20.4 +lxml==4.6.2 +numpy==1.20.0 +packaging==20.9 psycopg2-binary==2.8.6 redis==3.5.3 -requests==2.24.0 +requests==2.25.1 sgqlc==11.0 -web3==5.12.2 +web3==5.16.0 diff --git a/safe_relay_service/relay/migrations/0029_auto_20201102_1643.py b/safe_relay_service/relay/migrations/0029_auto_20201102_1643.py new file mode 100644 index 00000000..fdb8a472 --- /dev/null +++ b/safe_relay_service/relay/migrations/0029_auto_20201102_1643.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2020-11-02 16:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('relay', '0028_auto_20200922_1000'), + ] + + operations = [ + migrations.AlterField( + model_name='ethereumevent', + name='arguments', + field=models.JSONField(), + ), + ] diff --git a/safe_relay_service/relay/models.py b/safe_relay_service/relay/models.py index ca280b46..09ae0b6d 100644 --- a/safe_relay_service/relay/models.py +++ b/safe_relay_service/relay/models.py @@ -3,10 +3,10 @@ from enum import Enum from typing import Any, Dict, List, Optional, Union -from django.contrib.postgres.fields import ArrayField, JSONField +from django.contrib.postgres.fields import ArrayField from django.db import models -from django.db.models import (Avg, Case, Count, DurationField, F, Q, Sum, - Value, When) +from django.db.models import (Avg, Case, Count, DurationField, F, JSONField, Q, + Sum, Value, When) from django.db.models.expressions import RawSQL, Subquery, Window from django.db.models.functions import Cast, TruncDate from django.utils import timezone diff --git a/safe_relay_service/tokens/admin.py b/safe_relay_service/tokens/admin.py index 2398d412..b411e971 100644 --- a/safe_relay_service/tokens/admin.py +++ b/safe_relay_service/tokens/admin.py @@ -33,6 +33,8 @@ class TokenAdmin(admin.ModelAdmin): readonly_fields = ('eth_value', 'price_oracle_ticker_pairs') def eth_value(self, obj: Token): + if self.decimals is None: # Add token admin page + return .0 try: return obj.get_eth_value() except CannotGetTokenPriceFromApi: diff --git a/safe_relay_service/tokens/migrations/0014_auto_20201102_1643.py b/safe_relay_service/tokens/migrations/0014_auto_20201102_1643.py new file mode 100644 index 00000000..7d366feb --- /dev/null +++ b/safe_relay_service/tokens/migrations/0014_auto_20201102_1643.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.2 on 2020-11-02 16:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('tokens', '0013_auto_20200217_0942'), + ] + + operations = [ + migrations.AlterField( + model_name='priceoracle', + name='configuration', + field=models.JSONField(default=dict), + ), + ] diff --git a/safe_relay_service/tokens/models.py b/safe_relay_service/tokens/models.py index 77a765c9..f43d5767 100644 --- a/safe_relay_service/tokens/models.py +++ b/safe_relay_service/tokens/models.py @@ -4,8 +4,8 @@ from urllib.parse import urljoin, urlparse from django.conf import settings -from django.contrib.postgres.fields import JSONField from django.db import models +from django.db.models import JSONField from gnosis.eth.django.models import EthereumAddressField diff --git a/safe_relay_service/version.py b/safe_relay_service/version.py index 035509e5..055d74ff 100644 --- a/safe_relay_service/version.py +++ b/safe_relay_service/version.py @@ -1,2 +1,2 @@ -__version__ = '3.12.0' +__version__ = '3.12.1' __version_info__ = tuple([int(num) if num.isdigit() else num for num in __version__.replace('-', '.', 1).split('.')])