Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove python2 compatibility decorators #113

Merged
merged 2 commits into from
Jan 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions reversion_compare/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _
from reversion import RegistrationError

Expand All @@ -24,7 +24,6 @@
logger = logging.getLogger(__name__)


@python_2_unicode_compatible
class FieldVersionDoesNotExist:
"""
Sentinel object to handle missing fields
Expand Down
13 changes: 0 additions & 13 deletions reversion_compare_tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
from __future__ import unicode_literals, print_function

from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from django.db import models

from reversion import revisions


@python_2_unicode_compatible
class SimpleModel(models.Model):
text = models.CharField(max_length=255)

Expand All @@ -44,23 +42,20 @@ def __str__(self):
"""


@python_2_unicode_compatible
class Building(models.Model):
address = models.CharField(max_length=128)

def __str__(self):
return self.address


@python_2_unicode_compatible
class Factory(Building):
name = models.CharField(max_length=128)

def __str__(self):
return self.name


@python_2_unicode_compatible
class Car(models.Model):
name = models.CharField(max_length=128)
manufacturer = models.ForeignKey(Factory, related_name="cars", on_delete=models.CASCADE)
Expand All @@ -74,15 +69,13 @@ def __str__(self):
)


@python_2_unicode_compatible
class Pet(models.Model):
name = models.CharField(max_length=100)

def __str__(self):
return self.name


@python_2_unicode_compatible
class Person(models.Model):
name = models.CharField(max_length=100)
pets = models.ManyToManyField(Pet, blank=True)
Expand All @@ -93,7 +86,6 @@ def __str__(self):
return self.name


@python_2_unicode_compatible
class Identity(models.Model):
id_numer = models.CharField(max_length=100)
person = models.OneToOneField(Person, related_name="_identity", on_delete=models.CASCADE)
Expand All @@ -106,7 +98,6 @@ def __str__(self):
revisions.register(Pet)


@python_2_unicode_compatible
class VariantModel(models.Model):
"""
This model should contain all variants of all existing types,
Expand Down Expand Up @@ -170,14 +161,12 @@ class TemplateField(models.Model):


"""
@python_2_unicode_compatible
class ParentModel(models.Model):
parent_name = models.CharField(max_length=255)
def __str__(self):
return self.parent_name


@python_2_unicode_compatible
class ChildModel(ParentModel):
child_name = models.CharField(max_length=255)
file = models.FileField(upload_to="test", blank=True)
Expand All @@ -191,7 +180,6 @@ class Meta:
verbose_name_plural = _("child models")


@python_2_unicode_compatible
class RelatedModel(models.Model):
child_model = models.ForeignKey(ChildModel)
related_name = models.CharField(max_length=255)
Expand All @@ -201,7 +189,6 @@ def __str__(self):
return self.related_name


@python_2_unicode_compatible
class GenericRelatedModel(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.TextField()
Expand Down