PageRenderTime 31ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 17ms

/tests/regressiontests/generic_views/models.py

https://code.google.com/p/mango-py/
Python | 43 lines | 32 code | 11 blank | 0 comment | 0 complexity | d8bf0fcb332f25953a40fcfb180e7b75 MD5 | raw file
 1from django.db import models
 2
 3class Artist(models.Model):
 4    name = models.CharField(max_length=100)
 5
 6    class Meta:
 7        ordering = ['name']
 8        verbose_name = 'professional artist'
 9        verbose_name_plural = 'professional artists'
10
11    def __unicode__(self):
12        return self.name
13
14    @models.permalink
15    def get_absolute_url(self):
16        return ('artist_detail', (), {'pk': self.id})
17
18class Author(models.Model):
19    name = models.CharField(max_length=100)
20    slug = models.SlugField()
21
22    class Meta:
23        ordering = ['name']
24
25    def __unicode__(self):
26        return self.name
27
28class Book(models.Model):
29    name = models.CharField(max_length=300)
30    slug = models.SlugField()
31    pages = models.IntegerField()
32    authors = models.ManyToManyField(Author)
33    pubdate = models.DateField()
34
35    class Meta:
36        ordering = ['-pubdate']
37
38    def __unicode__(self):
39        return self.name
40
41class Page(models.Model):
42    content = models.TextField()
43    template = models.CharField(max_length=300)