summaryrefslogtreecommitdiff
path: root/tests/regressiontests/admin_ordering/models.py
blob: fb766777a9da4204602ab3a069e4ce2e9fb0c0e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# coding: utf-8
from django.db import models
from django.contrib import admin

class Band(models.Model):
    name = models.CharField(max_length=100)
    bio = models.TextField()
    rank = models.IntegerField()

    class Meta:
        ordering = ('name',)

class Song(models.Model):
    band = models.ForeignKey(Band)
    name = models.CharField(max_length=100)
    duration = models.IntegerField()

    class Meta:
        ordering = ('name',)

class SongInlineDefaultOrdering(admin.StackedInline):
    model = Song

class SongInlineNewOrdering(admin.StackedInline):
    model = Song
    ordering = ('duration', )