mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #23919 -- Removed python_2_unicode_compatible decorator usage
This commit is contained in:
@@ -11,10 +11,8 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Section(models.Model):
|
||||
"""
|
||||
A simple section that links to articles, to test linking to related items
|
||||
@@ -33,7 +31,6 @@ class Section(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Article(models.Model):
|
||||
"""
|
||||
A simple article to test admin views. Test backwards compatibility.
|
||||
@@ -59,7 +56,6 @@ class Article(models.Model):
|
||||
model_year_reversed.short_description = ''
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Book(models.Model):
|
||||
"""
|
||||
A simple book that has chapters.
|
||||
@@ -70,7 +66,6 @@ class Book(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Promo(models.Model):
|
||||
name = models.CharField(max_length=100, verbose_name='¿Name?')
|
||||
book = models.ForeignKey(Book, models.CASCADE)
|
||||
@@ -79,7 +74,6 @@ class Promo(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Chapter(models.Model):
|
||||
title = models.CharField(max_length=100, verbose_name='¿Title?')
|
||||
content = models.TextField()
|
||||
@@ -93,7 +87,6 @@ class Chapter(models.Model):
|
||||
verbose_name = '¿Chapter?'
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ChapterXtra1(models.Model):
|
||||
chap = models.OneToOneField(Chapter, models.CASCADE, verbose_name='¿Chap?')
|
||||
xtra = models.CharField(max_length=100, verbose_name='¿Xtra?')
|
||||
@@ -102,7 +95,6 @@ class ChapterXtra1(models.Model):
|
||||
return '¿Xtra1: %s' % self.xtra
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ChapterXtra2(models.Model):
|
||||
chap = models.OneToOneField(Chapter, models.CASCADE, verbose_name='¿Chap?')
|
||||
xtra = models.CharField(max_length=100, verbose_name='¿Xtra?')
|
||||
@@ -120,7 +112,6 @@ class CustomArticle(models.Model):
|
||||
date = models.DateTimeField()
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ModelWithStringPrimaryKey(models.Model):
|
||||
string_pk = models.CharField(max_length=255, primary_key=True)
|
||||
|
||||
@@ -131,7 +122,6 @@ class ModelWithStringPrimaryKey(models.Model):
|
||||
return '/dummy/%s/' % self.string_pk
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Color(models.Model):
|
||||
value = models.CharField(max_length=10)
|
||||
warm = models.BooleanField(default=False)
|
||||
@@ -146,7 +136,6 @@ class Color2(Color):
|
||||
proxy = True
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Thing(models.Model):
|
||||
title = models.CharField(max_length=20)
|
||||
color = models.ForeignKey(Color, models.CASCADE, limit_choices_to={'warm': True})
|
||||
@@ -156,7 +145,6 @@ class Thing(models.Model):
|
||||
return self.title
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Actor(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
age = models.IntegerField()
|
||||
@@ -166,7 +154,6 @@ class Actor(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Inquisition(models.Model):
|
||||
expected = models.BooleanField(default=False)
|
||||
leader = models.ForeignKey(Actor, models.CASCADE)
|
||||
@@ -176,7 +163,6 @@ class Inquisition(models.Model):
|
||||
return "by %s from %s" % (self.leader, self.country)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Sketch(models.Model):
|
||||
title = models.CharField(max_length=100)
|
||||
inquisition = models.ForeignKey(
|
||||
@@ -213,7 +199,6 @@ def today_callable_q():
|
||||
return models.Q(last_action__gte=datetime.datetime.today())
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Character(models.Model):
|
||||
username = models.CharField(max_length=100)
|
||||
last_action = models.DateTimeField()
|
||||
@@ -222,7 +207,6 @@ class Character(models.Model):
|
||||
return self.username
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class StumpJoke(models.Model):
|
||||
variation = models.CharField(max_length=100)
|
||||
most_recently_fooled = models.ForeignKey(
|
||||
@@ -248,7 +232,6 @@ class Fabric(models.Model):
|
||||
surface = models.CharField(max_length=20, choices=NG_CHOICES)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Person(models.Model):
|
||||
GENDER_CHOICES = (
|
||||
(1, "Male"),
|
||||
@@ -263,7 +246,6 @@ class Person(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Persona(models.Model):
|
||||
"""
|
||||
A simple persona associated with accounts, to test inlining of related
|
||||
@@ -275,7 +257,6 @@ class Persona(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Account(models.Model):
|
||||
"""
|
||||
A simple, generic account encapsulating the information shared by all
|
||||
@@ -299,7 +280,6 @@ class BarAccount(Account):
|
||||
servicename = 'bar'
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Subscriber(models.Model):
|
||||
name = models.CharField(blank=False, max_length=80)
|
||||
email = models.EmailField(blank=False, max_length=175)
|
||||
@@ -349,7 +329,6 @@ class Child(models.Model):
|
||||
raise ValidationError('invalid')
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class EmptyModel(models.Model):
|
||||
def __str__(self):
|
||||
return "Primary key = %s" % self.id
|
||||
@@ -433,7 +412,6 @@ class FancyDoodad(Doodad):
|
||||
expensive = models.BooleanField(default=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Category(models.Model):
|
||||
collector = models.ForeignKey(Collector, models.CASCADE)
|
||||
order = models.PositiveIntegerField()
|
||||
@@ -489,7 +467,6 @@ class FieldOverridePost(Post):
|
||||
proxy = True
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Gadget(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
@@ -497,7 +474,6 @@ class Gadget(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Villain(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
@@ -509,7 +485,6 @@ class SuperVillain(Villain):
|
||||
pass
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class FunkyTag(models.Model):
|
||||
"Because we all know there's only one real use case for GFKs."
|
||||
name = models.CharField(max_length=25)
|
||||
@@ -521,7 +496,6 @@ class FunkyTag(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Plot(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
team_leader = models.ForeignKey(Villain, models.CASCADE, related_name='lead_plots')
|
||||
@@ -532,7 +506,6 @@ class Plot(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class PlotDetails(models.Model):
|
||||
details = models.CharField(max_length=100)
|
||||
plot = models.OneToOneField(Plot, models.CASCADE, null=True, blank=True)
|
||||
@@ -546,7 +519,6 @@ class PlotProxy(Plot):
|
||||
proxy = True
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class SecretHideout(models.Model):
|
||||
""" Secret! Not registered with the admin! """
|
||||
location = models.CharField(max_length=100)
|
||||
@@ -556,7 +528,6 @@ class SecretHideout(models.Model):
|
||||
return self.location
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class SuperSecretHideout(models.Model):
|
||||
""" Secret! Not registered with the admin! """
|
||||
location = models.CharField(max_length=100)
|
||||
@@ -566,7 +537,6 @@ class SuperSecretHideout(models.Model):
|
||||
return self.location
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Bookmark(models.Model):
|
||||
name = models.CharField(max_length=60)
|
||||
tag = GenericRelation(FunkyTag, related_query_name='bookmark')
|
||||
@@ -575,7 +545,6 @@ class Bookmark(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CyclicOne(models.Model):
|
||||
name = models.CharField(max_length=25)
|
||||
two = models.ForeignKey('CyclicTwo', models.CASCADE)
|
||||
@@ -584,7 +553,6 @@ class CyclicOne(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CyclicTwo(models.Model):
|
||||
name = models.CharField(max_length=25)
|
||||
one = models.ForeignKey(CyclicOne, models.CASCADE)
|
||||
@@ -593,7 +561,6 @@ class CyclicTwo(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Topping(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
|
||||
@@ -625,7 +592,6 @@ class Question(models.Model):
|
||||
posted = models.DateField(default=datetime.date.today)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Answer(models.Model):
|
||||
question = models.ForeignKey(Question, models.PROTECT)
|
||||
answer = models.CharField(max_length=20)
|
||||
@@ -660,7 +626,6 @@ class FoodDelivery(models.Model):
|
||||
unique_together = (("driver", "restaurant"),)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class CoverLetter(models.Model):
|
||||
author = models.CharField(max_length=30)
|
||||
date_written = models.DateField(null=True, blank=True)
|
||||
@@ -679,7 +644,6 @@ class ShortMessage(models.Model):
|
||||
timestamp = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Telegram(models.Model):
|
||||
title = models.CharField(max_length=30)
|
||||
date_sent = models.DateField(null=True, blank=True)
|
||||
@@ -745,7 +709,6 @@ class AdminOrderedCallable(models.Model):
|
||||
stuff = models.CharField(max_length=200)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Report(models.Model):
|
||||
title = models.CharField(max_length=100)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user