Skip to content

Commit

Permalink
Misc: Remove usage of python_2_unicode_compatible
Browse files Browse the repository at this point in the history
Support for Python 2 is dropped.

Issue #2201
  • Loading branch information
nijel committed Feb 20, 2020
1 parent e99139a commit af737b4
Show file tree
Hide file tree
Showing 24 changed files with 0 additions and 66 deletions.
5 changes: 0 additions & 5 deletions weblate/accounts/models.py
Expand Up @@ -34,7 +34,6 @@
from django.utils.translation import LANGUAGE_SESSION_KEY, ugettext
from django.utils.translation import ugettext_lazy as _
from rest_framework.authtoken.models import Token
from six import python_2_unicode_compatible
from social_django.models import UserSocialAuth

from weblate.accounts.avatar import get_user_display
Expand All @@ -50,7 +49,6 @@
from weblate.utils.request import get_ip_address, get_user_agent


@python_2_unicode_compatible
class Subscription(models.Model):
user = models.ForeignKey(User, on_delete=models.deletion.CASCADE)
notification = models.CharField(
Expand Down Expand Up @@ -178,7 +176,6 @@ def order(self):
return self.order_by('-timestamp')


@python_2_unicode_compatible
class AuditLog(models.Model):
"""User audit log storage."""

Expand Down Expand Up @@ -253,7 +250,6 @@ def save(self, *args, **kwargs):
transaction.on_commit(lambda: notify_auditlog.delay(self.pk, email))


@python_2_unicode_compatible
class VerifiedEmail(models.Model):
"""Storage for verified e-mails from auth backends."""

Expand All @@ -268,7 +264,6 @@ def provider(self):
return self.social.provider


@python_2_unicode_compatible
class Profile(models.Model):
"""User profiles storage."""

Expand Down
3 changes: 0 additions & 3 deletions weblate/addons/models.py
Expand Up @@ -28,7 +28,6 @@
from django.dispatch import receiver
from django.urls import reverse
from django.utils.functional import cached_property
from six import python_2_unicode_compatible

from weblate.addons.events import (
EVENT_CHOICES,
Expand Down Expand Up @@ -83,7 +82,6 @@ def filter_event(self, component, event):
return component.addons_cache[event]


@python_2_unicode_compatible
class Addon(models.Model):
component = models.ForeignKey(Component, on_delete=models.deletion.CASCADE)
name = models.CharField(max_length=100)
Expand Down Expand Up @@ -123,7 +121,6 @@ def delete(self, *args, **kwargs):
super(Addon, self).delete(*args, **kwargs)


@python_2_unicode_compatible
class Event(models.Model):
addon = models.ForeignKey(Addon, on_delete=models.deletion.CASCADE)
event = models.IntegerField(choices=EVENT_CHOICES)
Expand Down
6 changes: 0 additions & 6 deletions weblate/auth/models.py
Expand Up @@ -34,7 +34,6 @@
from django.utils.functional import cached_property
from django.utils.translation import pgettext, ugettext
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.auth.data import (
ACL_GROUPS,
Expand Down Expand Up @@ -64,7 +63,6 @@
)


@python_2_unicode_compatible
class Permission(models.Model):
codename = models.CharField(max_length=100, unique=True)
name = models.CharField(max_length=200)
Expand All @@ -77,7 +75,6 @@ def __str__(self):
return ugettext(self.name)


@python_2_unicode_compatible
class Role(models.Model):
name = models.CharField(verbose_name=_('Name'), max_length=200)
permissions = models.ManyToManyField(
Expand All @@ -99,7 +96,6 @@ def for_project(self, project):
).order_by('name')


@python_2_unicode_compatible
class Group(models.Model):
SELECTION_MANUAL = 0
SELECTION_ALL = 1
Expand Down Expand Up @@ -276,7 +272,6 @@ def contribute_to_class(self, cls, name, **kwargs):
related_manager_cls.remove = wrap_group(related_manager_cls.remove)


@python_2_unicode_compatible
class User(AbstractBaseUser):
username = models.CharField(
_('username'),
Expand Down Expand Up @@ -488,7 +483,6 @@ def get_author_name(self, email=True):
return "{0} <{1}>".format(full_name, self.email)


@python_2_unicode_compatible
class AutoGroup(models.Model):
match = RegexField(
verbose_name=_('E-mail regular expression'),
Expand Down
4 changes: 0 additions & 4 deletions weblate/billing/models.py
Expand Up @@ -32,7 +32,6 @@
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.auth.models import User
from weblate.lang.models import Language
Expand All @@ -53,7 +52,6 @@ def public(self, user=None):
return result.distinct().order_by('price')


@python_2_unicode_compatible
class Plan(models.Model):
name = models.CharField(max_length=100, unique=True)
price = models.IntegerField(default=0)
Expand Down Expand Up @@ -119,7 +117,6 @@ def for_user(self, user):
)


@python_2_unicode_compatible
class Billing(models.Model):
STATE_ACTIVE = 0
STATE_TRIAL = 1
Expand Down Expand Up @@ -380,7 +377,6 @@ def order(self):
return self.order_by('-start')


@python_2_unicode_compatible
class Invoice(models.Model):
CURRENCY_EUR = 0
CURRENCY_BTC = 1
Expand Down
2 changes: 0 additions & 2 deletions weblate/checks/models.py
Expand Up @@ -26,7 +26,6 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.functional import cached_property
from six import python_2_unicode_compatible

from weblate.checks import CHECKS
from weblate.utils.decorators import disable_for_loaddata
Expand Down Expand Up @@ -111,7 +110,6 @@ def bulk_create_ignore(self, objs):
continue


@python_2_unicode_compatible
class Check(models.Model):
unit = models.ForeignKey("trans.Unit", on_delete=models.deletion.CASCADE)
check = models.CharField(max_length=50, choices=CHECKS.get_choices())
Expand Down
4 changes: 0 additions & 4 deletions weblate/fonts/models.py
Expand Up @@ -25,7 +25,6 @@
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.fonts.utils import get_font_name
from weblate.fonts.validators import validate_font
Expand All @@ -37,7 +36,6 @@
FONT_STORAGE = FileSystemStorage(location=data_dir("fonts"))


@python_2_unicode_compatible
class Font(models.Model, UserDisplayMixin):
family = models.CharField(verbose_name=_("Font family"), max_length=100, blank=True)
style = models.CharField(verbose_name=_("Font style"), max_length=100, blank=True)
Expand Down Expand Up @@ -100,7 +98,6 @@ def order(self):
return self.order_by("name")


@python_2_unicode_compatible
class FontGroup(models.Model):
name = models.SlugField(
verbose_name=_("Font group name"),
Expand Down Expand Up @@ -132,7 +129,6 @@ def get_absolute_url(self):
)


@python_2_unicode_compatible
class FontOverride(models.Model):
group = models.ForeignKey(FontGroup, on_delete=models.deletion.CASCADE)
font = models.ForeignKey(
Expand Down
3 changes: 0 additions & 3 deletions weblate/lang/models.py
Expand Up @@ -36,7 +36,6 @@
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from six import python_2_unicode_compatible

from weblate.lang import data
from weblate.langdata.aliases import ALIASES
Expand Down Expand Up @@ -377,7 +376,6 @@ def setup_lang(sender, **kwargs):
Language.objects.setup(False)


@python_2_unicode_compatible
class Language(models.Model):
code = models.SlugField(unique=True, verbose_name=ugettext_lazy('Language code'))
name = models.CharField(max_length=100, verbose_name=ugettext_lazy('Language name'))
Expand Down Expand Up @@ -447,7 +445,6 @@ def order(self):
return self.order_by('source')


@python_2_unicode_compatible
class Plural(models.Model):
PLURAL_CHOICES = (
(data.PLURAL_NONE, pgettext_lazy('Plural type', 'None')),
Expand Down
2 changes: 0 additions & 2 deletions weblate/legal/models.py
Expand Up @@ -23,7 +23,6 @@

from django.conf import settings
from django.db import models
from six import python_2_unicode_compatible

from weblate.accounts.models import AuditLog
from weblate.utils.request import get_ip_address, get_user_agent
Expand All @@ -32,7 +31,6 @@
TOS_DATE = date(2017, 7, 2)


@python_2_unicode_compatible
class Agreement(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL, unique=True, on_delete=models.deletion.CASCADE
Expand Down
2 changes: 0 additions & 2 deletions weblate/screenshots/models.py
Expand Up @@ -23,7 +23,6 @@
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.screenshots.fields import ScreenshotField
from weblate.trans.mixins import UserDisplayMixin
Expand All @@ -35,7 +34,6 @@ def order(self):
return self.order_by('name')


@python_2_unicode_compatible
class Screenshot(models.Model, UserDisplayMixin):
name = models.CharField(verbose_name=_('Screenshot name'), max_length=200)
image = ScreenshotField(
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/agreement.py
Expand Up @@ -21,7 +21,6 @@

from django.conf import settings
from django.db import models
from six import python_2_unicode_compatible


class ContributorAgreementManager(models.Manager):
Expand All @@ -43,7 +42,6 @@ def order(self):
return self.order_by('component__project__name', 'component__name')


@python_2_unicode_compatible
class ContributorAgreement(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL, on_delete=models.deletion.CASCADE
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/alert.py
Expand Up @@ -25,7 +25,6 @@
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.langdata.countries import DEFAULT_LANGS
from weblate.utils.fields import JSONField
Expand All @@ -42,7 +41,6 @@ def register(cls):
return cls


@python_2_unicode_compatible
class Alert(models.Model):
component = models.ForeignKey('Component', on_delete=models.deletion.CASCADE)
timestamp = models.DateTimeField(auto_now_add=True)
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/change.py
Expand Up @@ -25,7 +25,6 @@
from django.utils import timezone
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from six import python_2_unicode_compatible

from weblate.lang.models import Language
from weblate.trans.mixins import UserDisplayMixin
Expand Down Expand Up @@ -155,7 +154,6 @@ def create(self, user=None, **kwargs):
return super(ChangeManager, self).create(user=user, **kwargs)


@python_2_unicode_compatible
class Change(models.Model, UserDisplayMixin):
ACTION_UPDATE = 0
ACTION_COMPLETE = 1
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/comment.py
Expand Up @@ -21,7 +21,6 @@

from django.conf import settings
from django.db import models
from six import python_2_unicode_compatible

from weblate.trans.mixins import UserDisplayMixin
from weblate.trans.models.change import Change
Expand All @@ -48,7 +47,6 @@ def order(self):
return self.order_by('timestamp')


@python_2_unicode_compatible
class Comment(models.Model, UserDisplayMixin):
unit = models.ForeignKey("trans.Unit", on_delete=models.deletion.CASCADE)
comment = models.TextField()
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/component.py
Expand Up @@ -40,7 +40,6 @@
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy, ungettext
from six import python_2_unicode_compatible
from six.moves.urllib.parse import urlparse

from weblate.checks.flags import Flags
Expand Down Expand Up @@ -161,7 +160,6 @@ def with_repo(self):
return self.exclude(repo__startswith="weblate:")


@python_2_unicode_compatible
class Component(models.Model, URLMixin, PathMixin):
name = models.CharField(
verbose_name=ugettext_lazy("Component name"),
Expand Down
3 changes: 0 additions & 3 deletions weblate/trans/models/componentlist.py
Expand Up @@ -25,7 +25,6 @@
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from six import python_2_unicode_compatible

from weblate.trans.fields import RegexField
from weblate.utils.stats import ComponentListStats
Expand All @@ -36,7 +35,6 @@ def order(self):
return self.order_by('name')


@python_2_unicode_compatible
class ComponentList(models.Model):

name = models.CharField(
Expand Down Expand Up @@ -85,7 +83,6 @@ def get_absolute_url(self):
return reverse('component-list', kwargs={'name': self.slug})


@python_2_unicode_compatible
class AutoComponentList(models.Model):
project_match = RegexField(
verbose_name=_('Project regular expression'),
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/dictionary.py
Expand Up @@ -25,7 +25,6 @@
from django.db import models
from django.db.models.functions import Lower
from django.urls import reverse
from six import python_2_unicode_compatible
from whoosh.analysis import LanguageAnalyzer, NgramAnalyzer, SimpleAnalyzer
from whoosh.analysis.filters import StopFilter
from whoosh.lang import NoStopWords
Expand Down Expand Up @@ -171,7 +170,6 @@ def order(self):
return self.order_by(Lower('source'))


@python_2_unicode_compatible
class Dictionary(models.Model):
project = models.ForeignKey(Project, on_delete=models.deletion.CASCADE)
language = models.ForeignKey(Language, on_delete=models.deletion.CASCADE)
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/label.py
Expand Up @@ -23,10 +23,8 @@
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy
from six import python_2_unicode_compatible


@python_2_unicode_compatible
class Label(models.Model):
project = models.ForeignKey("Project", on_delete=models.deletion.CASCADE)
name = models.CharField(verbose_name=ugettext_lazy("Label name"), max_length=190)
Expand Down
2 changes: 0 additions & 2 deletions weblate/trans/models/project.py
Expand Up @@ -30,7 +30,6 @@
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext_lazy
from six import python_2_unicode_compatible

from weblate.checks import CHECKS
from weblate.checks.models import Check
Expand All @@ -47,7 +46,6 @@ def order(self):
return self.order_by('name')


@python_2_unicode_compatible
class Project(models.Model, URLMixin, PathMixin):
ACCESS_PUBLIC = 0
ACCESS_PROTECTED = 1
Expand Down

0 comments on commit af737b4

Please sign in to comment.