~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to tests/regressiontests/generic_views/models.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (6.2.12 experimental)
  • Revision ID: package-import@ubuntu.com-20130509151047-g79qsrewg1yl43h5
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from django.core.urlresolvers import reverse
1
2
from django.db import models
2
 
 
3
 
 
 
3
from django.utils.encoding import python_2_unicode_compatible
 
4
 
 
5
 
 
6
@python_2_unicode_compatible
4
7
class Artist(models.Model):
5
8
    name = models.CharField(max_length=100)
6
9
 
9
12
        verbose_name = 'professional artist'
10
13
        verbose_name_plural = 'professional artists'
11
14
 
12
 
    def __unicode__(self):
 
15
    def __str__(self):
13
16
        return self.name
14
17
 
15
 
    @models.permalink
16
18
    def get_absolute_url(self):
17
 
        return ('artist_detail', (), {'pk': self.id})
 
19
        return reverse('artist_detail', kwargs={'pk': self.id})
18
20
 
 
21
@python_2_unicode_compatible
19
22
class Author(models.Model):
20
23
    name = models.CharField(max_length=100)
21
24
    slug = models.SlugField()
23
26
    class Meta:
24
27
        ordering = ['name']
25
28
 
26
 
    def __unicode__(self):
 
29
    def __str__(self):
27
30
        return self.name
28
31
 
 
32
@python_2_unicode_compatible
29
33
class Book(models.Model):
30
34
    name = models.CharField(max_length=300)
31
35
    slug = models.SlugField()
36
40
    class Meta:
37
41
        ordering = ['-pubdate']
38
42
 
39
 
    def __unicode__(self):
 
43
    def __str__(self):
40
44
        return self.name
41
45
 
42
46
class Page(models.Model):
43
47
    content = models.TextField()
44
48
    template = models.CharField(max_length=300)
 
49
 
 
50
class BookSigning(models.Model):
 
51
    event_date = models.DateTimeField()