2008-07-18 23:54:34 +00:00
|
|
|
# coding: utf-8
|
|
|
|
from django.db import models
|
2010-12-12 22:56:01 +00:00
|
|
|
from django.contrib import admin
|
2008-07-18 23:54:34 +00:00
|
|
|
|
|
|
|
class Band(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
bio = models.TextField()
|
|
|
|
rank = models.IntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('name',)
|
2010-12-12 22:56:01 +00:00
|
|
|
|
|
|
|
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', )
|