Remove python_2_unicode_compatible decorators

pull/3934/head
Matt Westcott 2017-10-13 11:56:28 +01:00
rodzic 5f382d8784
commit 70e342a38d
18 zmienionych plików z 3 dodań i 50 usunięć

Wyświetl plik

@ -7,7 +7,7 @@ from django.db import DEFAULT_DB_ALIAS, NotSupportedError, connections, transact
from django.db.models import F, Manager, TextField, Value
from django.db.models.constants import LOOKUP_SEP
from django.db.models.functions import Cast
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.six import string_types
from wagtail.wagtailsearch.backends.base import (
@ -35,7 +35,6 @@ def get_pk_column(model):
return model._meta.pk.get_attname_column()[1]
@python_2_unicode_compatible
class Index(object):
def __init__(self, backend, model, db_alias=None):
self.backend = backend

Wyświetl plik

@ -7,7 +7,7 @@ from django.db.models import (
CASCADE, AutoField, BigAutoField, BigIntegerField, F, ForeignKey, IntegerField, Model, QuerySet,
TextField)
from django.db.models.functions import Cast
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from .utils import WEIGHTS_VALUES, get_descendants_content_types_pks
@ -47,7 +47,6 @@ class IndexQuerySet(QuerySet):
return self.annotate_typed_pk().values_list('typed_pk', flat=True)
@python_2_unicode_compatible
class IndexEntry(Model):
content_type = ForeignKey(ContentType, on_delete=CASCADE)
# We do not use an IntegerField since primary keys are not always integers.

Wyświetl plik

@ -1,11 +1,8 @@
from __future__ import absolute_import, unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from .registry import registry
@python_2_unicode_compatible
class SettingsProxy(dict):
"""
Get a SettingModuleProxy for an app using proxy['app_label']
@ -21,7 +18,6 @@ class SettingsProxy(dict):
return 'SettingsProxy'
@python_2_unicode_compatible
class SettingModuleProxy(dict):
"""
Get a setting instance using proxy['modelname']

Wyświetl plik

@ -1,13 +1,11 @@
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from wagtail.wagtailcore.models import Page
from wagtail.wagtailsearch import index
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=255)
date_of_birth = models.DateField()
@ -23,7 +21,6 @@ class Author(models.Model):
return ''
@python_2_unicode_compatible
class Book(models.Model, index.Indexed):
author = models.ForeignKey(Author, on_delete=models.PROTECT)
title = models.CharField(max_length=255)
@ -33,7 +30,6 @@ class Book(models.Model, index.Indexed):
return self.title
@python_2_unicode_compatible
class Token(models.Model):
key = models.CharField(max_length=40, primary_key=True)
@ -41,7 +37,6 @@ class Token(models.Model):
return self.key
@python_2_unicode_compatible
class Publisher(models.Model):
name = models.CharField(max_length=50)
headquartered_in = models.CharField(max_length=50, null=True, blank=True)

Wyświetl plik

@ -1,7 +1,6 @@
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
@ -19,7 +18,6 @@ from .forms import FancySnippetForm
# to ensure specific [in]correct register ordering
# AlphaSnippet is registered during TestSnippetOrdering
@python_2_unicode_compatible
class AlphaSnippet(models.Model):
text = models.CharField(max_length=255)
@ -28,7 +26,6 @@ class AlphaSnippet(models.Model):
# ZuluSnippet is registered during TestSnippetOrdering
@python_2_unicode_compatible
class ZuluSnippet(models.Model):
text = models.CharField(max_length=255)

Wyświetl plik

@ -12,7 +12,6 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six import text_type
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey, ParentalManyToManyField
@ -199,7 +198,6 @@ class EventPageSpeaker(Orderable, LinkFields):
]
@python_2_unicode_compatible
class EventCategory(models.Model):
name = models.CharField("Name", max_length=255)
@ -519,7 +517,6 @@ class AdvertTag(TaggedItemBase):
content_object = ParentalKey('Advert', related_name='tagged_items', on_delete=models.CASCADE)
@python_2_unicode_compatible
class Advert(ClusterableModel):
url = models.URLField(null=True, blank=True)
text = models.CharField(max_length=255)
@ -539,7 +536,6 @@ class Advert(ClusterableModel):
register_snippet(Advert)
@python_2_unicode_compatible
class AdvertWithTabbedInterface(models.Model):
url = models.URLField(null=True, blank=True)
text = models.CharField(max_length=255)

Wyświetl plik

@ -9,7 +9,6 @@ from django.core.urlresolvers import reverse
from django.forms import widgets
from django.forms.utils import flatatt
from django.template.loader import render_to_string
from django.utils.encoding import python_2_unicode_compatible
from django.utils.formats import get_format
from django.utils.functional import cached_property
from django.utils.html import format_html
@ -217,7 +216,6 @@ class AdminPageChooser(AdminChooser):
)
@python_2_unicode_compatible
@total_ordering
class Button(object):
show = True

Wyświetl plik

@ -8,7 +8,7 @@ from django.core import checks
from django.core.exceptions import ImproperlyConfigured
from django.template.loader import render_to_string
from django.utils import six
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from django.utils.text import capfirst
@ -411,7 +411,6 @@ class Block(six.with_metaclass(BaseBlock, object)):
__hash__ = None
@python_2_unicode_compatible
class BoundBlock(object):
def __init__(self, block, value, prefix=None, errors=None):
self.block = block

Wyświetl plik

@ -10,7 +10,6 @@ from django.forms.utils import ErrorList
from django.template.loader import render_to_string
# Must be imported from Django so we get the new implementation of with_metaclass
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import format_html_join
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
@ -326,7 +325,6 @@ class StreamBlock(six.with_metaclass(DeclarativeSubBlocksMetaclass, BaseStreamBl
pass
@python_2_unicode_compatible # provide equivalent __unicode__ and __str__ methods on Py2
class StreamValue(collections.Sequence):
"""
Custom type used to represent the value of a StreamBlock; behaves as a sequence of BoundBlocks

Wyświetl plik

@ -21,7 +21,6 @@ from django.http import Http404
from django.template.response import TemplateResponse
# Must be imported from Django so we get the new implementation of with_metaclass
from django.utils import six, timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
from django.utils.six import StringIO
from django.utils.six.moves.urllib.parse import urlparse
@ -48,7 +47,6 @@ class SiteManager(models.Manager):
return self.get(hostname=hostname, port=port)
@python_2_unicode_compatible
class Site(models.Model):
hostname = models.CharField(verbose_name=_('hostname'), max_length=255, db_index=True)
port = models.IntegerField(
@ -243,7 +241,6 @@ class AbstractPage(MP_Node):
abstract = True
@python_2_unicode_compatible
class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, ClusterableModel)):
title = models.CharField(
verbose_name=_('title'),
@ -1407,7 +1404,6 @@ class SubmittedRevisionsManager(models.Manager):
return super(SubmittedRevisionsManager, self).get_queryset().filter(submitted_for_moderation=True)
@python_2_unicode_compatible
class PageRevision(models.Model):
page = models.ForeignKey('Page', verbose_name=_('page'), related_name='revisions', on_delete=models.CASCADE)
submitted_for_moderation = models.BooleanField(
@ -1560,7 +1556,6 @@ PAGE_PERMISSION_TYPE_CHOICES = [
]
@python_2_unicode_compatible
class GroupPagePermission(models.Model):
group = models.ForeignKey(Group, verbose_name=_('group'), related_name='page_permissions', on_delete=models.CASCADE)
page = models.ForeignKey('Page', verbose_name=_('page'), related_name='group_permissions', on_delete=models.CASCADE)
@ -1945,7 +1940,6 @@ class CollectionViewRestriction(BaseViewRestriction):
verbose_name_plural = _('collection view restrictions')
@python_2_unicode_compatible
class Collection(MP_Node):
"""
A location in which resources such as images and documents can be grouped
@ -2005,7 +1999,6 @@ class CollectionMember(models.Model):
abstract = True
@python_2_unicode_compatible
class GroupCollectionPermission(models.Model):
"""
A rule indicating that a group has permission for some action (e.g. "create document")

Wyświetl plik

@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals
import re # parsing HTML with regexes LIKE A BOSS.
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import escape
from django.utils.safestring import mark_safe
@ -182,7 +181,6 @@ def expand_db_html(html, for_editor=False):
return html
@python_2_unicode_compatible
class RichText(object):
"""
A custom object used to represent a renderable rich text value.

Wyświetl plik

@ -7,7 +7,6 @@ from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.db import models
from django.dispatch import Signal
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
@ -21,7 +20,6 @@ class DocumentQuerySet(SearchableQuerySetMixin, models.QuerySet):
pass
@python_2_unicode_compatible
class AbstractDocument(CollectionMember, index.Indexed, models.Model):
title = models.CharField(max_length=255, verbose_name=_('title'))
file = models.FileField(upload_to='documents', verbose_name=_('file'))

Wyświetl plik

@ -1,12 +1,9 @@
from __future__ import absolute_import, unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from wagtail.wagtailcore import blocks
from wagtail.wagtailembeds.format import embed_to_frontend_html
@python_2_unicode_compatible
class EmbedValue(object):
"""
Native value of an EmbedBlock. Should, at minimum, have a 'url' property

Wyświetl plik

@ -1,7 +1,6 @@
from __future__ import absolute_import, division, unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
EMBED_TYPES = (
@ -12,7 +11,6 @@ EMBED_TYPES = (
)
@python_2_unicode_compatible
class Embed(models.Model):
"""
When embed code is fetched from a provider (eg, youtube) we cache that code

Wyświetl plik

@ -7,7 +7,6 @@ from django.contrib.contenttypes.models import ContentType
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.shortcuts import render
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six import text_type
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
@ -36,7 +35,6 @@ FORM_FIELD_CHOICES = (
)
@python_2_unicode_compatible
class AbstractFormSubmission(models.Model):
"""
Data for a form submission.

Wyświetl plik

@ -11,7 +11,6 @@ from django.core.files import File
from django.core.urlresolvers import reverse
from django.db import models
from django.forms.utils import flatatt
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
from django.utils.safestring import mark_safe
from django.utils.six import BytesIO, string_types, text_type
@ -62,7 +61,6 @@ def get_rendition_upload_to(instance, filename):
return instance.get_upload_to(filename)
@python_2_unicode_compatible
class AbstractImage(CollectionMember, index.Indexed, models.Model):
title = models.CharField(max_length=255, verbose_name=_('title'))
file = models.ImageField(

Wyświetl plik

@ -5,13 +5,11 @@ import datetime
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailsearch.utils import MAX_QUERY_STRING_LENGTH, normalise_query_string
@python_2_unicode_compatible
class Query(models.Model):
query_string = models.CharField(max_length=MAX_QUERY_STRING_LENGTH, unique=True)

Wyświetl plik

@ -2,11 +2,9 @@ from __future__ import absolute_import, unicode_literals
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class UserProfile(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='wagtail_userprofile'