Removed unused __str__() methods in tests models.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
This commit is contained in:
parent
f1a808a502
commit
6461583b6c
|
@ -6,17 +6,11 @@ class Author(models.Model):
|
|||
age = models.IntegerField()
|
||||
friends = models.ManyToManyField('self', blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Publisher(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
num_awards = models.IntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
isbn = models.CharField(max_length=9)
|
||||
|
@ -29,9 +23,6 @@ class Book(models.Model):
|
|||
publisher = models.ForeignKey(Publisher, models.CASCADE)
|
||||
pubdate = models.DateField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Store(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
@ -40,16 +31,10 @@ class Store(models.Model):
|
|||
friday_night_closing = models.TimeField()
|
||||
area = models.IntegerField(null=True, db_column='surface')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class DepartmentStore(Store):
|
||||
chain = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return '%s - %s ' % (self.chain, self.name)
|
||||
|
||||
|
||||
class Employee(models.Model):
|
||||
# The order of these fields matter, do not change. Certain backends
|
||||
|
@ -62,9 +47,6 @@ class Employee(models.Model):
|
|||
age = models.IntegerField()
|
||||
salary = models.DecimalField(max_digits=8, decimal_places=2)
|
||||
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
class Company(models.Model):
|
||||
name = models.CharField(max_length=200)
|
||||
|
@ -81,6 +63,3 @@ class Company(models.Model):
|
|||
class Ticket(models.Model):
|
||||
active_at = models.DateTimeField()
|
||||
duration = models.DurationField()
|
||||
|
||||
def __str__(self):
|
||||
return '{} - {}'.format(self.active_at, self.duration)
|
||||
|
|
|
@ -17,6 +17,3 @@ class Article(models.Model):
|
|||
|
||||
class MySQLUnixTimestamp(models.Model):
|
||||
timestamp = models.PositiveIntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -19,9 +19,6 @@ class Donut(models.Model):
|
|||
class Meta:
|
||||
ordering = ('consumed_at',)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class RumBaba(models.Model):
|
||||
baked_date = models.DateField(auto_now_add=True)
|
||||
|
|
|
@ -9,9 +9,6 @@ class Article(models.Model):
|
|||
|
||||
categories = models.ManyToManyField("Category", related_name="articles")
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class Comment(models.Model):
|
||||
article = models.ForeignKey(Article, models.CASCADE, related_name="comments")
|
||||
|
@ -19,9 +16,6 @@ class Comment(models.Model):
|
|||
pub_date = models.DateField()
|
||||
approval_date = models.DateField(null=True)
|
||||
|
||||
def __str__(self):
|
||||
return 'Comment to %s (%s)' % (self.article.title, self.pub_date)
|
||||
|
||||
|
||||
class Category(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
|
|
@ -6,10 +6,6 @@ from django.db import models
|
|||
class Cash(decimal.Decimal):
|
||||
currency = 'USD'
|
||||
|
||||
def __str__(self):
|
||||
s = super().__str__(self)
|
||||
return '%s %s' % (s, self.currency)
|
||||
|
||||
|
||||
class CashField(models.DecimalField):
|
||||
def __init__(self, **kwargs):
|
||||
|
@ -25,6 +21,3 @@ class CashField(models.DecimalField):
|
|||
|
||||
class CashModel(models.Model):
|
||||
cash = CashField()
|
||||
|
||||
def __str__(self):
|
||||
return str(self.cash)
|
||||
|
|
|
@ -16,9 +16,6 @@ from django.db import models
|
|||
class Author(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class ArticleManager(models.Manager):
|
||||
def get_queryset(self):
|
||||
|
@ -36,6 +33,3 @@ class Article(models.Model):
|
|||
objects = models.Manager()
|
||||
by_a_sir = ArticleManager()
|
||||
attribute_error_objects = AttributeErrorManager()
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
|
|
@ -5,9 +5,6 @@ class City(models.Model):
|
|||
id = models.BigAutoField(primary_key=True)
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Country(models.Model):
|
||||
id = models.SmallAutoField(primary_key=True)
|
||||
|
@ -18,9 +15,6 @@ class District(models.Model):
|
|||
city = models.ForeignKey(City, models.CASCADE, primary_key=True)
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Reporter(models.Model):
|
||||
first_name = models.CharField(max_length=30)
|
||||
|
@ -34,9 +28,6 @@ class Reporter(models.Model):
|
|||
class Meta:
|
||||
unique_together = ('first_name', 'last_name')
|
||||
|
||||
def __str__(self):
|
||||
return "%s %s" % (self.first_name, self.last_name)
|
||||
|
||||
|
||||
class Article(models.Model):
|
||||
headline = models.CharField(max_length=100)
|
||||
|
@ -53,9 +44,6 @@ class Article(models.Model):
|
|||
['headline', 'response_to', 'pub_date', 'reporter'],
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
return self.headline
|
||||
|
||||
|
||||
class ArticleReporter(models.Model):
|
||||
article = models.ForeignKey(Article, models.CASCADE)
|
||||
|
|
|
@ -34,9 +34,6 @@ class Comment(models.Model):
|
|||
class Meta:
|
||||
ordering = ('comment_text',)
|
||||
|
||||
def __str__(self):
|
||||
return self.comment_text
|
||||
|
||||
# Ticket 15823
|
||||
|
||||
|
||||
|
|
|
@ -89,9 +89,6 @@ class CharFieldModel(models.Model):
|
|||
class TextFieldModel(models.Model):
|
||||
field = models.TextField()
|
||||
|
||||
def __str__(self):
|
||||
return self.field
|
||||
|
||||
|
||||
class SmallAutoFieldModel(models.Model):
|
||||
id = models.SmallAutoField(primary_key=True)
|
||||
|
@ -107,16 +104,10 @@ class Scene(models.Model):
|
|||
scene = models.CharField(max_length=255)
|
||||
setting = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.scene
|
||||
|
||||
|
||||
class Character(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class CITestModel(PostgreSQLModel):
|
||||
name = CICharField(primary_key=True, max_length=255)
|
||||
|
@ -124,9 +115,6 @@ class CITestModel(PostgreSQLModel):
|
|||
description = CITextField()
|
||||
array_field = ArrayField(CITextField(), null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Line(PostgreSQLModel):
|
||||
scene = models.ForeignKey('Scene', models.CASCADE)
|
||||
|
@ -135,9 +123,6 @@ class Line(PostgreSQLModel):
|
|||
dialogue_search_vector = SearchVectorField(blank=True, null=True)
|
||||
dialogue_config = models.CharField(max_length=100, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.dialogue or ''
|
||||
|
||||
|
||||
class LineSavedSearch(PostgreSQLModel):
|
||||
line = models.ForeignKey('Line', models.CASCADE)
|
||||
|
|
|
@ -16,9 +16,6 @@ class Car(models.Model):
|
|||
make = models.CharField(max_length=20)
|
||||
model = models.CharField(max_length=20)
|
||||
|
||||
def __str__(self):
|
||||
return "%s %s" % (self.make, self.model)
|
||||
|
||||
|
||||
class Author(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
|
|
|
@ -12,9 +12,6 @@ class AbstractArticle(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class SyndicatedArticle(AbstractArticle):
|
||||
sites = models.ManyToManyField(Site)
|
||||
|
|
|
@ -5,9 +5,6 @@ class Foo(models.Model):
|
|||
name = models.CharField(max_length=50)
|
||||
friend = models.CharField(max_length=50, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return "Foo %s" % self.name
|
||||
|
||||
|
||||
class Bar(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
@ -15,36 +12,21 @@ class Bar(models.Model):
|
|||
fwd = models.ForeignKey("Whiz", models.CASCADE)
|
||||
back = models.ForeignKey("Foo", models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return "Bar %s" % self.place.name
|
||||
|
||||
|
||||
class Whiz(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return "Whiz %s" % self.name
|
||||
|
||||
|
||||
class Child(models.Model):
|
||||
parent = models.OneToOneField('Base', models.CASCADE)
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return "Child %s" % self.name
|
||||
|
||||
|
||||
class Base(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
|
||||
def __str__(self):
|
||||
return "Base %s" % self.name
|
||||
|
||||
|
||||
class Article(models.Model):
|
||||
name = models.CharField(max_length=50)
|
||||
text = models.TextField()
|
||||
submitted_from = models.GenericIPAddressField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return "Article %s" % self.name
|
||||
|
|
|
@ -19,6 +19,3 @@ class Entry(models.Model):
|
|||
class Article(models.Model):
|
||||
title = models.CharField(max_length=200)
|
||||
entry = models.ForeignKey(Entry, models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
|
|
@ -4,17 +4,11 @@ from django.db import models
|
|||
class Car(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Person(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
cars = models.ManyToManyField(Car, through='PossessedCar')
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class PossessedCar(models.Model):
|
||||
car = models.ForeignKey(Car, models.CASCADE)
|
||||
|
|
|
@ -3,6 +3,3 @@ from django.db import models
|
|||
|
||||
class Thing(models.Model):
|
||||
num = models.IntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return "Thing %d" % self.num
|
||||
|
|
|
@ -15,9 +15,6 @@ class A01(models.Model):
|
|||
class Meta:
|
||||
db_table = 'a01'
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
|
||||
class B01(models.Model):
|
||||
fk_a = models.ForeignKey(A01, models.CASCADE)
|
||||
|
@ -29,9 +26,6 @@ class B01(models.Model):
|
|||
# 'managed' is True by default. This tests we can set it explicitly.
|
||||
managed = True
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
|
||||
class C01(models.Model):
|
||||
mm_a = models.ManyToManyField(A01, db_table='d01')
|
||||
|
@ -41,8 +35,6 @@ class C01(models.Model):
|
|||
class Meta:
|
||||
db_table = 'c01'
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
# All of these models use the same tables as the previous set (they are shadows
|
||||
# of possibly a subset of the columns). There should be no creation errors,
|
||||
|
@ -56,9 +48,6 @@ class A02(models.Model):
|
|||
db_table = 'a01'
|
||||
managed = False
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
|
||||
class B02(models.Model):
|
||||
class Meta:
|
||||
|
@ -69,9 +58,6 @@ class B02(models.Model):
|
|||
f_a = models.CharField(max_length=10, db_index=True)
|
||||
f_b = models.IntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
|
||||
# To re-use the many-to-many intermediate table, we need to manually set up
|
||||
# things up.
|
||||
|
@ -84,9 +70,6 @@ class C02(models.Model):
|
|||
db_table = 'c01'
|
||||
managed = False
|
||||
|
||||
def __str__(self):
|
||||
return self.f_a
|
||||
|
||||
|
||||
class Intermediate(models.Model):
|
||||
a02 = models.ForeignKey(A02, models.CASCADE, db_column="a01_id")
|
||||
|
|
|
@ -11,17 +11,11 @@ class DataPoint(models.Model):
|
|||
value = models.CharField(max_length=20)
|
||||
another_value = models.CharField(max_length=20, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class RelatedPoint(models.Model):
|
||||
name = models.CharField(max_length=20)
|
||||
data = models.ForeignKey(DataPoint, models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class A(models.Model):
|
||||
x = models.IntegerField(default=10)
|
||||
|
|
|
@ -15,9 +15,6 @@ class Person(models.Model):
|
|||
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
|
||||
pid = models.IntegerField(null=True, default=None)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Employee(Person):
|
||||
employee_num = models.IntegerField(default=0)
|
||||
|
@ -29,9 +26,6 @@ class Profile(models.Model):
|
|||
name = models.CharField(max_length=200)
|
||||
salary = models.FloatField(default=1000.0)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class ProxyEmployee(Employee):
|
||||
class Meta:
|
||||
|
|
|
@ -94,9 +94,6 @@ class Post(models.Model):
|
|||
subtitle = models.CharField(max_length=50, unique_for_month='posted', blank=True)
|
||||
posted = models.DateField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class FlexibleDatePost(models.Model):
|
||||
title = models.CharField(max_length=50, unique_for_date='posted', blank=True)
|
||||
|
|
|
@ -8,9 +8,6 @@ from django.db import models
|
|||
class Author(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
def get_absolute_url(self):
|
||||
return '/authors/%s/' % self.id
|
||||
|
||||
|
@ -27,9 +24,6 @@ class BaseArticle(models.Model):
|
|||
class Meta:
|
||||
abstract = True
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
|
||||
|
||||
class Article(BaseArticle):
|
||||
date_created = models.DateTimeField()
|
||||
|
|
Loading…
Reference in New Issue