Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Get rid of `RemovedInDjango110Warning` warnings

Adam Bogdał85d1ac43303e
diff --git a/saleor/core/templatetags/bootstrap.py b/saleor/core/templatetags/bootstrap.py
index b6557ef160..67ab240677 100644
--- a/saleor/core/templatetags/bootstrap.py
+++ b/saleor/core/templatetags/bootstrap.py
@@ -1,7 +1,7 @@
from django import forms
from django.forms.forms import BoundField, BaseForm
from django.forms.utils import ErrorList
-from django.template import Library, Context, TemplateSyntaxError
+from django.template import Library, TemplateSyntaxError
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
@@ -16,8 +16,8 @@ TEMPLATE_PAGINATION = 'bootstrap/_pagination.html'
def render_non_field_errors(errors):
if not errors:
return ''
- context = Context({'errors': errors})
- return render_to_string(TEMPLATE_ERRORS, context_instance=context)
+ context = {'errors': errors}
+ return render_to_string(TEMPLATE_ERRORS, context=context)
def render_field(bound_field, show_label, template):
@@ -36,10 +36,11 @@ def render_field(bound_field, show_label, template):
else:
input_type = 'input'
- context = Context({'bound_field': bound_field,
- 'input_type': input_type,
- 'show_label': show_label})
- return render_to_string(template, context_instance=context)
+ context = {
+ 'bound_field': bound_field,
+ 'input_type': input_type,
+ 'show_label': show_label}
+ return render_to_string(template, context=context)
def as_bootstrap(obj, show_label, template):
@@ -76,5 +77,5 @@ def render_widget(obj, **attrs):
@register.filter
def as_pagination(items):
- context = Context({'items': items})
- return render_to_string(TEMPLATE_PAGINATION, context_instance=context)
+ context = {'items': items}
+ return render_to_string(TEMPLATE_PAGINATION, context=context)
diff --git a/saleor/urls.py b/saleor/urls.py
index 7c80fabe28..0f3d9c8070 100644
--- a/saleor/urls.py
+++ b/saleor/urls.py
@@ -2,7 +2,7 @@ from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap
-
+from django.views.static import serve
from .cart.urls import urlpatterns as cart_urls
from .checkout.urls import urlpatterns as checkout_urls
@@ -18,7 +18,7 @@ from .dashboard.urls import urlpatterns as dashboard_urls
admin.autodiscover()
urlpatterns = [
- url(r'^$', include(core_urls), name='home'),
+ url(r'^', include(core_urls)),
url(r'^account/', include(registration_urls, namespace='registration')),
url(r'^admin/', include(admin.site.urls)),
url(r'^cart/', include(cart_urls, namespace='cart')),
@@ -36,5 +36,5 @@ urlpatterns = [
if settings.DEBUG:
# static files (images, css, javascript, etc.)
urlpatterns += [
- url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
+ url(r'^media/(?P<path>.*)$', serve,
{'document_root': settings.MEDIA_ROOT})]