Unverified Commit ae753561 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Fix deprecation warnings for Django 1.11

parent d7d62d20
......@@ -5,7 +5,7 @@ from django.db.models import Q
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import string_concat
from django.utils.text import format_lazy
from tinymce.models import HTMLField
from thaliawebsite.settings import settings
......@@ -113,8 +113,8 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
max_length=200,
blank=True,
null=True,
help_text=(string_concat(_("Default: "),
DEFAULT_NO_REGISTRATION_MESSAGE)),
help_text=(format_lazy("{} {}", _("Default:"),
DEFAULT_NO_REGISTRATION_MESSAGE)),
)
published = models.BooleanField(_("published"), default=False)
......
......@@ -5,10 +5,10 @@ from . import views
app_name = "newsletters"
urlpatterns = [
url('^(?P<pk>\d+)/$', views.preview, name='preview'),
url('^(?P<pk>\d+)/(?P<lang>[-\w]+)/$', views.preview,
url(r'^(?P<pk>\d+)/$', views.preview, name='preview'),
url(r'^(?P<pk>\d+)/(?P<lang>[-\w]+)/$', views.preview,
name='preview-localised'),
url(r'admin/send/(?P<pk>\d+)/$', views.admin_send, name='admin-send'),
url('^(?P<year>\d+)/(?P<week>\d+)/nieuwsbrief.html',
url(r'^(?P<year>\d+)/(?P<week>\d+)/nieuwsbrief.html',
views.legacy_redirect, name='legacy-redirect')
]
......@@ -28,8 +28,8 @@ class Partner(models.Model):
address = models.CharField(max_length=100, validators=[
RegexValidator(
regex=(r'^([1-9][e][\s])*([ëéÉËa-zA-Z]'
'+(([\.][\s])|([\s]))?)+[1-9][0-9]'
'*(([-][1-9][0-9]*)|([\s]?[ëéÉËa-zA-Z]+))?$'),
r'+(([\.][\s])|([\s]))?)+[1-9][0-9]'
r'*(([-][1-9][0-9]*)|([\s]?[ëéÉËa-zA-Z]+))?$'),
message=_('Enter a valid address'))
])
zip_code = models.CharField(max_length=12, validators=[
......
......@@ -3,7 +3,8 @@ from django.contrib import admin
from django.core.exceptions import FieldError, ImproperlyConfigured
from django.db import models
from django.db.models.fields.related import RelatedField
from django.utils.translation import get_language, string_concat
from django.utils.text import format_lazy
from django.utils.translation import get_language
"""This module makes it easy to define translatable model fields.
......@@ -89,8 +90,8 @@ class ModelTranslateMeta(models.base.ModelBase):
fields = []
for lang in settings.LANGUAGES:
attr_i18n = localize_attr_name(attr, lang[0])
verbose_name = string_concat(
verbose_base[1], ' (', lang[0].upper(), ')')
verbose_name = format_lazy(
'{} ({})', verbose_base[1], lang[0].upper())
if verbose_base[0] == 'args':
field.args = (verbose_name,) + field.args[1:]
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment