Closes #167: Deprecation, removes in Django 4 Warnings

This commit is contained in:
adi 2019-12-26 20:30:25 +01:00
parent 533d0bbcbf
commit 4b34e6ce71
2 changed files with 11 additions and 11 deletions

View file

@ -1,10 +1,10 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.forms import ValidationError
class MarkdownxImageUploadError(ValidationError):
"""
Custom **MarkdownX** exceptions.
Custom **MarkdownX** exceptions.
"""
@classmethod
@ -13,9 +13,9 @@ class MarkdownxImageUploadError(ValidationError):
No file is available to upload.
:return: Locale compatible version of the error with the following message:
- No files have been uploaded.
:rtype: MarkdownxImageUploadError
"""
return cls(_('No files have been uploaded.'))
@ -23,14 +23,14 @@ class MarkdownxImageUploadError(ValidationError):
@classmethod
def unsupported_format(cls):
"""
The file is of a format not defined in :guilabel:`settings.py`
or if default, in :guilabel:`markdownx/settings.py`.
:return: Locale compatible version of the error with the following message:
- File type is not supported.
- File type is not supported.
:rtype: MarkdownxImageUploadError
"""
return cls(_('File type is not supported.'))
@ -45,9 +45,9 @@ class MarkdownxImageUploadError(ValidationError):
:param expected: Expected (maximum permitted) size of the file.
:type expected: float, int
:return: Locale compatible version of the error with the following message:
- Please keep file size under %(max)s. Current file size: %(current)s.'
:rtype: MarkdownxImageUploadError
"""
from django.template.defaultfilters import filesizeformat

View file

@ -1,6 +1,6 @@
# Django library.
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ImproperlyConfigured