Loading tests/admin_changelist/models.py +15 −0 Original line number Diff line number Diff line from django.db import models from django.utils.encoding import python_2_unicode_compatible class Event(models.Model): # Oracle can have problems with a column named "date" date = models.DateField(db_column="event_date") class Parent(models.Model): name = models.CharField(max_length=128) class Child(models.Model): parent = models.ForeignKey(Parent, editable=False, null=True) name = models.CharField(max_length=30, blank=True) age = models.IntegerField(null=True, blank=True) class Genre(models.Model): name = models.CharField(max_length=20) class Band(models.Model): name = models.CharField(max_length=20) nr_of_members = models.PositiveIntegerField() genres = models.ManyToManyField(Genre) @python_2_unicode_compatible class Musician(models.Model): name = models.CharField(max_length=30) Loading @@ -28,6 +34,7 @@ class Musician(models.Model): def __str__(self): return self.name @python_2_unicode_compatible class Group(models.Model): name = models.CharField(max_length=30) Loading @@ -36,26 +43,32 @@ class Group(models.Model): def __str__(self): return self.name class Membership(models.Model): music = models.ForeignKey(Musician) group = models.ForeignKey(Group) role = models.CharField(max_length=15) class Quartet(Group): pass class ChordsMusician(Musician): pass class ChordsBand(models.Model): name = models.CharField(max_length=30) members = models.ManyToManyField(ChordsMusician, through='Invitation') class Invitation(models.Model): player = models.ForeignKey(ChordsMusician) band = models.ForeignKey(ChordsBand) instrument = models.CharField(max_length=15) class Swallow(models.Model): origin = models.CharField(max_length=255) load = models.FloatField() Loading @@ -77,6 +90,7 @@ class OrderedObjectManager(models.Manager): def get_queryset(self): return super(OrderedObjectManager, self).get_queryset().order_by('number') class OrderedObject(models.Model): """ Model with Manager that defines a default order. Loading @@ -88,5 +102,6 @@ class OrderedObject(models.Model): objects = OrderedObjectManager() class CustomIdUser(models.Model): uuid = models.AutoField(primary_key=True) tests/admin_custom_urls/models.py +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ class ActionAdmin(admin.ModelAdmin): class Person(models.Model): name = models.CharField(max_length=20) class PersonAdmin(admin.ModelAdmin): def response_post_save_add(self, request, obj): Loading @@ -68,6 +69,7 @@ class PersonAdmin(admin.ModelAdmin): class Car(models.Model): name = models.CharField(max_length=20) class CarAdmin(admin.ModelAdmin): def response_add(self, request, obj, post_url_continue=None): Loading tests/admin_docs/views.py +2 −0 Original line number Diff line number Diff line Loading @@ -5,9 +5,11 @@ from django.contrib.admindocs.middleware import XViewMiddleware xview_dec = decorator_from_middleware(XViewMiddleware) def xview(request): return HttpResponse() class XViewClass(View): def get(self, request): return HttpResponse() tests/admin_filters/models.py +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ class Department(models.Model): def __str__(self): return self.description @python_2_unicode_compatible class Employee(models.Model): department = models.ForeignKey(Department, to_field="code") Loading tests/admin_inlines/admin.py +3 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ class ChildModel1Inline(admin.TabularInline): class ChildModel2Inline(admin.StackedInline): model = ChildModel2 # admin for #19425 and #18388 class BinaryTreeAdmin(admin.TabularInline): model = BinaryTree Loading @@ -169,10 +170,12 @@ class BinaryTreeAdmin(admin.TabularInline): return max_num - obj.binarytree_set.count() return max_num # admin for #19524 class SightingInline(admin.TabularInline): model = Sighting # admin and form for #18263 class SomeChildModelForm(forms.ModelForm): Loading Loading
tests/admin_changelist/models.py +15 −0 Original line number Diff line number Diff line from django.db import models from django.utils.encoding import python_2_unicode_compatible class Event(models.Model): # Oracle can have problems with a column named "date" date = models.DateField(db_column="event_date") class Parent(models.Model): name = models.CharField(max_length=128) class Child(models.Model): parent = models.ForeignKey(Parent, editable=False, null=True) name = models.CharField(max_length=30, blank=True) age = models.IntegerField(null=True, blank=True) class Genre(models.Model): name = models.CharField(max_length=20) class Band(models.Model): name = models.CharField(max_length=20) nr_of_members = models.PositiveIntegerField() genres = models.ManyToManyField(Genre) @python_2_unicode_compatible class Musician(models.Model): name = models.CharField(max_length=30) Loading @@ -28,6 +34,7 @@ class Musician(models.Model): def __str__(self): return self.name @python_2_unicode_compatible class Group(models.Model): name = models.CharField(max_length=30) Loading @@ -36,26 +43,32 @@ class Group(models.Model): def __str__(self): return self.name class Membership(models.Model): music = models.ForeignKey(Musician) group = models.ForeignKey(Group) role = models.CharField(max_length=15) class Quartet(Group): pass class ChordsMusician(Musician): pass class ChordsBand(models.Model): name = models.CharField(max_length=30) members = models.ManyToManyField(ChordsMusician, through='Invitation') class Invitation(models.Model): player = models.ForeignKey(ChordsMusician) band = models.ForeignKey(ChordsBand) instrument = models.CharField(max_length=15) class Swallow(models.Model): origin = models.CharField(max_length=255) load = models.FloatField() Loading @@ -77,6 +90,7 @@ class OrderedObjectManager(models.Manager): def get_queryset(self): return super(OrderedObjectManager, self).get_queryset().order_by('number') class OrderedObject(models.Model): """ Model with Manager that defines a default order. Loading @@ -88,5 +102,6 @@ class OrderedObject(models.Model): objects = OrderedObjectManager() class CustomIdUser(models.Model): uuid = models.AutoField(primary_key=True)
tests/admin_custom_urls/models.py +2 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ class ActionAdmin(admin.ModelAdmin): class Person(models.Model): name = models.CharField(max_length=20) class PersonAdmin(admin.ModelAdmin): def response_post_save_add(self, request, obj): Loading @@ -68,6 +69,7 @@ class PersonAdmin(admin.ModelAdmin): class Car(models.Model): name = models.CharField(max_length=20) class CarAdmin(admin.ModelAdmin): def response_add(self, request, obj, post_url_continue=None): Loading
tests/admin_docs/views.py +2 −0 Original line number Diff line number Diff line Loading @@ -5,9 +5,11 @@ from django.contrib.admindocs.middleware import XViewMiddleware xview_dec = decorator_from_middleware(XViewMiddleware) def xview(request): return HttpResponse() class XViewClass(View): def get(self, request): return HttpResponse()
tests/admin_filters/models.py +1 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ class Department(models.Model): def __str__(self): return self.description @python_2_unicode_compatible class Employee(models.Model): department = models.ForeignKey(Department, to_field="code") Loading
tests/admin_inlines/admin.py +3 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ class ChildModel1Inline(admin.TabularInline): class ChildModel2Inline(admin.StackedInline): model = ChildModel2 # admin for #19425 and #18388 class BinaryTreeAdmin(admin.TabularInline): model = BinaryTree Loading @@ -169,10 +170,12 @@ class BinaryTreeAdmin(admin.TabularInline): return max_num - obj.binarytree_set.count() return max_num # admin for #19524 class SightingInline(admin.TabularInline): model = Sighting # admin and form for #18263 class SomeChildModelForm(forms.ModelForm): Loading