Removed useless model definitions.

Surprisingly, this commit doesn't change any behavior at all. When a
model is defined with the same name as another model in the same app,
the definition of the first class is bound to the name of the class
regardless of the definition of the second class.
This commit is contained in:
Aymeric Augustin 2014-01-05 09:29:54 +01:00
parent 2692a0c621
commit a7588e2e22
2 changed files with 16 additions and 36 deletions

View File

@ -12,28 +12,29 @@ from django.core.files.storage import FileSystemStorage
from django.core.mail import EmailMessage from django.core.mail import EmailMessage
from django.core.servers.basehttp import FileWrapper from django.core.servers.basehttp import FileWrapper
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.db import models
from django.forms.models import BaseModelFormSet from django.forms.models import BaseModelFormSet
from django.http import HttpResponse, StreamingHttpResponse from django.http import HttpResponse, StreamingHttpResponse
from django.contrib.admin import BooleanFieldListFilter from django.contrib.admin import BooleanFieldListFilter
from django.utils.six import StringIO from django.utils.six import StringIO
from .models import (Article, Chapter, Account, Media, Child, Parent, Picture, from .models import (Article, Chapter, Child, Parent, Picture, Widget,
Widget, DooHickey, Grommet, Whatsit, FancyDoodad, Category, Link, DooHickey, Grommet, Whatsit, FancyDoodad, Category, Link,
PrePopulatedPost, PrePopulatedSubPost, CustomArticle, Section, PrePopulatedPost, PrePopulatedSubPost, CustomArticle, Section,
ModelWithStringPrimaryKey, Color, Thing, Actor, Inquisition, Sketch, Person, ModelWithStringPrimaryKey, Color, Thing, Actor, Inquisition, Sketch,
Persona, Subscriber, ExternalSubscriber, OldSubscriber, Vodcast, EmptyModel, Person, Persona, FooAccount, BarAccount, Subscriber, ExternalSubscriber,
Fabric, Gallery, Language, Recommendation, Recommender, Collector, Post, OldSubscriber, Podcast, Vodcast, EmptyModel, Fabric, Gallery, Language,
Gadget, Villain, SuperVillain, Plot, PlotDetails, CyclicOne, CyclicTwo, Recommendation, Recommender, Collector, Post, Gadget, Villain,
WorkHour, Reservation, FoodDelivery, RowLevelChangePermissionModel, Paper, SuperVillain, Plot, PlotDetails, CyclicOne, CyclicTwo, WorkHour,
Reservation, FoodDelivery, RowLevelChangePermissionModel, Paper,
CoverLetter, Story, OtherStory, Book, Promo, ChapterXtra1, Pizza, Topping, CoverLetter, Story, OtherStory, Book, Promo, ChapterXtra1, Pizza, Topping,
Album, Question, Answer, ComplexSortedPerson, PluggableSearchPerson, PrePopulatedPostLargeSlug, Album, Question, Answer, ComplexSortedPerson, PluggableSearchPerson,
AdminOrderedField, AdminOrderedModelMethod, AdminOrderedAdminMethod, PrePopulatedPostLargeSlug, AdminOrderedField, AdminOrderedModelMethod,
AdminOrderedCallable, Report, Color2, UnorderedObject, MainPrepopulated, AdminOrderedAdminMethod, AdminOrderedCallable, Report, Color2,
RelatedPrepopulated, UndeletableObject, UnchangeableObject, UserMessenger, Simple, Choice, UnorderedObject, MainPrepopulated, RelatedPrepopulated, UndeletableObject,
ShortMessage, Telegram, FilteredManager, EmptyModelHidden, UnchangeableObject, UserMessenger, Simple, Choice, ShortMessage, Telegram,
EmptyModelVisible, EmptyModelMixin, State, City, Restaurant, Worker, FilteredManager, EmptyModelHidden, EmptyModelVisible, EmptyModelMixin,
ParentWithDependentChildren, DependentChild) State, City, Restaurant, Worker, ParentWithDependentChildren,
DependentChild)
def callable_year(dt_value): def callable_year(dt_value):
@ -190,16 +191,6 @@ class PersonAdmin(admin.ModelAdmin):
return super(PersonAdmin, self).get_queryset(request).order_by('age') return super(PersonAdmin, self).get_queryset(request).order_by('age')
class FooAccount(Account):
"""A service-specific account of type Foo."""
servicename = 'foo'
class BarAccount(Account):
"""A service-specific account of type Bar."""
servicename = 'bar'
class FooAccountAdmin(admin.StackedInline): class FooAccountAdmin(admin.StackedInline):
model = FooAccount model = FooAccount
extra = 1 extra = 1
@ -261,13 +252,6 @@ class ExternalSubscriberAdmin(admin.ModelAdmin):
actions = [redirect_to, external_mail, download, no_perm] actions = [redirect_to, external_mail, download, no_perm]
class Podcast(Media):
release_date = models.DateField()
class Meta:
ordering = ('release_date',) # overridden in PodcastAdmin
class PodcastAdmin(admin.ModelAdmin): class PodcastAdmin(admin.ModelAdmin):
list_display = ('name', 'release_date') list_display = ('name', 'release_date')
list_editable = ('release_date',) list_editable = ('release_date',)

View File

@ -82,10 +82,6 @@ class Location(models.Model):
location1 = models.CharField(max_length=1000, default='location1') location1 = models.CharField(max_length=1000, default='location1')
class Item(models.Model):
pass
class Request(models.Model): class Request(models.Model):
profile = models.ForeignKey(Profile, null=True, blank=True) profile = models.ForeignKey(Profile, null=True, blank=True)
location = models.ForeignKey(Location) location = models.ForeignKey(Location)