kopia lustrzana https://github.com/wagtail/wagtail
Remove python_2_unicode_compatible decorators
rodzic
5f382d8784
commit
70e342a38d
|
@ -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 import F, Manager, TextField, Value
|
||||||
from django.db.models.constants import LOOKUP_SEP
|
from django.db.models.constants import LOOKUP_SEP
|
||||||
from django.db.models.functions import Cast
|
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 django.utils.six import string_types
|
||||||
|
|
||||||
from wagtail.wagtailsearch.backends.base import (
|
from wagtail.wagtailsearch.backends.base import (
|
||||||
|
@ -35,7 +35,6 @@ def get_pk_column(model):
|
||||||
return model._meta.pk.get_attname_column()[1]
|
return model._meta.pk.get_attname_column()[1]
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Index(object):
|
class Index(object):
|
||||||
def __init__(self, backend, model, db_alias=None):
|
def __init__(self, backend, model, db_alias=None):
|
||||||
self.backend = backend
|
self.backend = backend
|
||||||
|
|
|
@ -7,7 +7,7 @@ from django.db.models import (
|
||||||
CASCADE, AutoField, BigAutoField, BigIntegerField, F, ForeignKey, IntegerField, Model, QuerySet,
|
CASCADE, AutoField, BigAutoField, BigIntegerField, F, ForeignKey, IntegerField, Model, QuerySet,
|
||||||
TextField)
|
TextField)
|
||||||
from django.db.models.functions import Cast
|
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 django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from .utils import WEIGHTS_VALUES, get_descendants_content_types_pks
|
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)
|
return self.annotate_typed_pk().values_list('typed_pk', flat=True)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class IndexEntry(Model):
|
class IndexEntry(Model):
|
||||||
content_type = ForeignKey(ContentType, on_delete=CASCADE)
|
content_type = ForeignKey(ContentType, on_delete=CASCADE)
|
||||||
# We do not use an IntegerField since primary keys are not always integers.
|
# We do not use an IntegerField since primary keys are not always integers.
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
|
|
||||||
from .registry import registry
|
from .registry import registry
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class SettingsProxy(dict):
|
class SettingsProxy(dict):
|
||||||
"""
|
"""
|
||||||
Get a SettingModuleProxy for an app using proxy['app_label']
|
Get a SettingModuleProxy for an app using proxy['app_label']
|
||||||
|
@ -21,7 +18,6 @@ class SettingsProxy(dict):
|
||||||
return 'SettingsProxy'
|
return 'SettingsProxy'
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class SettingModuleProxy(dict):
|
class SettingModuleProxy(dict):
|
||||||
"""
|
"""
|
||||||
Get a setting instance using proxy['modelname']
|
Get a setting instance using proxy['modelname']
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
|
|
||||||
from wagtail.wagtailcore.models import Page
|
from wagtail.wagtailcore.models import Page
|
||||||
from wagtail.wagtailsearch import index
|
from wagtail.wagtailsearch import index
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Author(models.Model):
|
class Author(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
date_of_birth = models.DateField()
|
date_of_birth = models.DateField()
|
||||||
|
@ -23,7 +21,6 @@ class Author(models.Model):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Book(models.Model, index.Indexed):
|
class Book(models.Model, index.Indexed):
|
||||||
author = models.ForeignKey(Author, on_delete=models.PROTECT)
|
author = models.ForeignKey(Author, on_delete=models.PROTECT)
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
|
@ -33,7 +30,6 @@ class Book(models.Model, index.Indexed):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Token(models.Model):
|
class Token(models.Model):
|
||||||
key = models.CharField(max_length=40, primary_key=True)
|
key = models.CharField(max_length=40, primary_key=True)
|
||||||
|
|
||||||
|
@ -41,7 +37,6 @@ class Token(models.Model):
|
||||||
return self.key
|
return self.key
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Publisher(models.Model):
|
class Publisher(models.Model):
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
headquartered_in = models.CharField(max_length=50, null=True, blank=True)
|
headquartered_in = models.CharField(max_length=50, null=True, blank=True)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from modelcluster.fields import ParentalKey
|
from modelcluster.fields import ParentalKey
|
||||||
from modelcluster.models import ClusterableModel
|
from modelcluster.models import ClusterableModel
|
||||||
|
|
||||||
|
@ -19,7 +18,6 @@ from .forms import FancySnippetForm
|
||||||
# to ensure specific [in]correct register ordering
|
# to ensure specific [in]correct register ordering
|
||||||
|
|
||||||
# AlphaSnippet is registered during TestSnippetOrdering
|
# AlphaSnippet is registered during TestSnippetOrdering
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AlphaSnippet(models.Model):
|
class AlphaSnippet(models.Model):
|
||||||
text = models.CharField(max_length=255)
|
text = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
@ -28,7 +26,6 @@ class AlphaSnippet(models.Model):
|
||||||
|
|
||||||
|
|
||||||
# ZuluSnippet is registered during TestSnippetOrdering
|
# ZuluSnippet is registered during TestSnippetOrdering
|
||||||
@python_2_unicode_compatible
|
|
||||||
class ZuluSnippet(models.Model):
|
class ZuluSnippet(models.Model):
|
||||||
text = models.CharField(max_length=255)
|
text = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.six import text_type
|
from django.utils.six import text_type
|
||||||
from modelcluster.contrib.taggit import ClusterTaggableManager
|
from modelcluster.contrib.taggit import ClusterTaggableManager
|
||||||
from modelcluster.fields import ParentalKey, ParentalManyToManyField
|
from modelcluster.fields import ParentalKey, ParentalManyToManyField
|
||||||
|
@ -199,7 +198,6 @@ class EventPageSpeaker(Orderable, LinkFields):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EventCategory(models.Model):
|
class EventCategory(models.Model):
|
||||||
name = models.CharField("Name", max_length=255)
|
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)
|
content_object = ParentalKey('Advert', related_name='tagged_items', on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Advert(ClusterableModel):
|
class Advert(ClusterableModel):
|
||||||
url = models.URLField(null=True, blank=True)
|
url = models.URLField(null=True, blank=True)
|
||||||
text = models.CharField(max_length=255)
|
text = models.CharField(max_length=255)
|
||||||
|
@ -539,7 +536,6 @@ class Advert(ClusterableModel):
|
||||||
register_snippet(Advert)
|
register_snippet(Advert)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AdvertWithTabbedInterface(models.Model):
|
class AdvertWithTabbedInterface(models.Model):
|
||||||
url = models.URLField(null=True, blank=True)
|
url = models.URLField(null=True, blank=True)
|
||||||
text = models.CharField(max_length=255)
|
text = models.CharField(max_length=255)
|
||||||
|
|
|
@ -9,7 +9,6 @@ from django.core.urlresolvers import reverse
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from django.forms.utils import flatatt
|
from django.forms.utils import flatatt
|
||||||
from django.template.loader import render_to_string
|
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.formats import get_format
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
|
@ -217,7 +216,6 @@ class AdminPageChooser(AdminChooser):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class Button(object):
|
class Button(object):
|
||||||
show = True
|
show = True
|
||||||
|
|
|
@ -8,7 +8,7 @@ from django.core import checks
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.utils import six
|
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.safestring import mark_safe
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
|
|
||||||
|
@ -411,7 +411,6 @@ class Block(six.with_metaclass(BaseBlock, object)):
|
||||||
__hash__ = None
|
__hash__ = None
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class BoundBlock(object):
|
class BoundBlock(object):
|
||||||
def __init__(self, block, value, prefix=None, errors=None):
|
def __init__(self, block, value, prefix=None, errors=None):
|
||||||
self.block = block
|
self.block = block
|
||||||
|
|
|
@ -10,7 +10,6 @@ from django.forms.utils import ErrorList
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
# Must be imported from Django so we get the new implementation of with_metaclass
|
# Must be imported from Django so we get the new implementation of with_metaclass
|
||||||
from django.utils import six
|
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.html import format_html_join
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
@ -326,7 +325,6 @@ class StreamBlock(six.with_metaclass(DeclarativeSubBlocksMetaclass, BaseStreamBl
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible # provide equivalent __unicode__ and __str__ methods on Py2
|
|
||||||
class StreamValue(collections.Sequence):
|
class StreamValue(collections.Sequence):
|
||||||
"""
|
"""
|
||||||
Custom type used to represent the value of a StreamBlock; behaves as a sequence of BoundBlocks
|
Custom type used to represent the value of a StreamBlock; behaves as a sequence of BoundBlocks
|
||||||
|
|
|
@ -21,7 +21,6 @@ from django.http import Http404
|
||||||
from django.template.response import TemplateResponse
|
from django.template.response import TemplateResponse
|
||||||
# Must be imported from Django so we get the new implementation of with_metaclass
|
# Must be imported from Django so we get the new implementation of with_metaclass
|
||||||
from django.utils import six, timezone
|
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.functional import cached_property
|
||||||
from django.utils.six import StringIO
|
from django.utils.six import StringIO
|
||||||
from django.utils.six.moves.urllib.parse import urlparse
|
from django.utils.six.moves.urllib.parse import urlparse
|
||||||
|
@ -48,7 +47,6 @@ class SiteManager(models.Manager):
|
||||||
return self.get(hostname=hostname, port=port)
|
return self.get(hostname=hostname, port=port)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Site(models.Model):
|
class Site(models.Model):
|
||||||
hostname = models.CharField(verbose_name=_('hostname'), max_length=255, db_index=True)
|
hostname = models.CharField(verbose_name=_('hostname'), max_length=255, db_index=True)
|
||||||
port = models.IntegerField(
|
port = models.IntegerField(
|
||||||
|
@ -243,7 +241,6 @@ class AbstractPage(MP_Node):
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, ClusterableModel)):
|
class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, ClusterableModel)):
|
||||||
title = models.CharField(
|
title = models.CharField(
|
||||||
verbose_name=_('title'),
|
verbose_name=_('title'),
|
||||||
|
@ -1407,7 +1404,6 @@ class SubmittedRevisionsManager(models.Manager):
|
||||||
return super(SubmittedRevisionsManager, self).get_queryset().filter(submitted_for_moderation=True)
|
return super(SubmittedRevisionsManager, self).get_queryset().filter(submitted_for_moderation=True)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class PageRevision(models.Model):
|
class PageRevision(models.Model):
|
||||||
page = models.ForeignKey('Page', verbose_name=_('page'), related_name='revisions', on_delete=models.CASCADE)
|
page = models.ForeignKey('Page', verbose_name=_('page'), related_name='revisions', on_delete=models.CASCADE)
|
||||||
submitted_for_moderation = models.BooleanField(
|
submitted_for_moderation = models.BooleanField(
|
||||||
|
@ -1560,7 +1556,6 @@ PAGE_PERMISSION_TYPE_CHOICES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class GroupPagePermission(models.Model):
|
class GroupPagePermission(models.Model):
|
||||||
group = models.ForeignKey(Group, verbose_name=_('group'), related_name='page_permissions', on_delete=models.CASCADE)
|
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)
|
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')
|
verbose_name_plural = _('collection view restrictions')
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Collection(MP_Node):
|
class Collection(MP_Node):
|
||||||
"""
|
"""
|
||||||
A location in which resources such as images and documents can be grouped
|
A location in which resources such as images and documents can be grouped
|
||||||
|
@ -2005,7 +1999,6 @@ class CollectionMember(models.Model):
|
||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class GroupCollectionPermission(models.Model):
|
class GroupCollectionPermission(models.Model):
|
||||||
"""
|
"""
|
||||||
A rule indicating that a group has permission for some action (e.g. "create document")
|
A rule indicating that a group has permission for some action (e.g. "create document")
|
||||||
|
|
|
@ -2,7 +2,6 @@ from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import re # parsing HTML with regexes LIKE A BOSS.
|
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.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
|
@ -182,7 +181,6 @@ def expand_db_html(html, for_editor=False):
|
||||||
return html
|
return html
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class RichText(object):
|
class RichText(object):
|
||||||
"""
|
"""
|
||||||
A custom object used to represent a renderable rich text value.
|
A custom object used to represent a renderable rich text value.
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.dispatch import Signal
|
from django.dispatch import Signal
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from taggit.managers import TaggableManager
|
from taggit.managers import TaggableManager
|
||||||
|
|
||||||
|
@ -21,7 +20,6 @@ class DocumentQuerySet(SearchableQuerySetMixin, models.QuerySet):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AbstractDocument(CollectionMember, index.Indexed, models.Model):
|
class AbstractDocument(CollectionMember, index.Indexed, models.Model):
|
||||||
title = models.CharField(max_length=255, verbose_name=_('title'))
|
title = models.CharField(max_length=255, verbose_name=_('title'))
|
||||||
file = models.FileField(upload_to='documents', verbose_name=_('file'))
|
file = models.FileField(upload_to='documents', verbose_name=_('file'))
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
|
|
||||||
from wagtail.wagtailcore import blocks
|
from wagtail.wagtailcore import blocks
|
||||||
from wagtail.wagtailembeds.format import embed_to_frontend_html
|
from wagtail.wagtailembeds.format import embed_to_frontend_html
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class EmbedValue(object):
|
class EmbedValue(object):
|
||||||
"""
|
"""
|
||||||
Native value of an EmbedBlock. Should, at minimum, have a 'url' property
|
Native value of an EmbedBlock. Should, at minimum, have a 'url' property
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import absolute_import, division, unicode_literals
|
from __future__ import absolute_import, division, unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
EMBED_TYPES = (
|
EMBED_TYPES = (
|
||||||
|
@ -12,7 +11,6 @@ EMBED_TYPES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Embed(models.Model):
|
class Embed(models.Model):
|
||||||
"""
|
"""
|
||||||
When embed code is fetched from a provider (eg, youtube) we cache that code
|
When embed code is fetched from a provider (eg, youtube) we cache that code
|
||||||
|
|
|
@ -7,7 +7,6 @@ from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.serializers.json import DjangoJSONEncoder
|
from django.core.serializers.json import DjangoJSONEncoder
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.six import text_type
|
from django.utils.six import text_type
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
@ -36,7 +35,6 @@ FORM_FIELD_CHOICES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AbstractFormSubmission(models.Model):
|
class AbstractFormSubmission(models.Model):
|
||||||
"""
|
"""
|
||||||
Data for a form submission.
|
Data for a form submission.
|
||||||
|
|
|
@ -11,7 +11,6 @@ from django.core.files import File
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.forms.utils import flatatt
|
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.functional import cached_property
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.six import BytesIO, string_types, text_type
|
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)
|
return instance.get_upload_to(filename)
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class AbstractImage(CollectionMember, index.Indexed, models.Model):
|
class AbstractImage(CollectionMember, index.Indexed, models.Model):
|
||||||
title = models.CharField(max_length=255, verbose_name=_('title'))
|
title = models.CharField(max_length=255, verbose_name=_('title'))
|
||||||
file = models.ImageField(
|
file = models.ImageField(
|
||||||
|
|
|
@ -5,13 +5,11 @@ import datetime
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from wagtail.wagtailsearch.utils import MAX_QUERY_STRING_LENGTH, normalise_query_string
|
from wagtail.wagtailsearch.utils import MAX_QUERY_STRING_LENGTH, normalise_query_string
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class Query(models.Model):
|
class Query(models.Model):
|
||||||
query_string = models.CharField(max_length=MAX_QUERY_STRING_LENGTH, unique=True)
|
query_string = models.CharField(max_length=MAX_QUERY_STRING_LENGTH, unique=True)
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,9 @@ from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
|
||||||
class UserProfile(models.Model):
|
class UserProfile(models.Model):
|
||||||
user = models.OneToOneField(
|
user = models.OneToOneField(
|
||||||
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='wagtail_userprofile'
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='wagtail_userprofile'
|
||||||
|
|
Ładowanie…
Reference in New Issue