PageRenderTime 61ms CodeModel.GetById 46ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/regressiontests/admin_ordering/models.py

https://code.google.com/p/mango-py/
Python | 26 lines | 19 code | 6 blank | 1 comment | 0 complexity | 5b824666ae9dd4a9209dbc3da66149ae MD5 | raw file
Possible License(s): BSD-3-Clause
  1. # coding: utf-8
  2. from django.db import models
  3. from django.contrib import admin
  4. class Band(models.Model):
  5. name = models.CharField(max_length=100)
  6. bio = models.TextField()
  7. rank = models.IntegerField()
  8. class Meta:
  9. ordering = ('name',)
  10. class Song(models.Model):
  11. band = models.ForeignKey(Band)
  12. name = models.CharField(max_length=100)
  13. duration = models.IntegerField()
  14. class Meta:
  15. ordering = ('name',)
  16. class SongInlineDefaultOrdering(admin.StackedInline):
  17. model = Song
  18. class SongInlineNewOrdering(admin.StackedInline):
  19. model = Song
  20. ordering = ('duration', )