mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #6735 -- Added class-based views.
This patch is the result of the work of many people, over many years. To try and thank individuals would inevitably lead to many people being left out or forgotten -- so rather than try to give a list that will inevitably be incomplete, I'd like to thank *everybody* who contributed in any way, big or small, with coding, testing, feedback and/or documentation over the multi-year process of getting this into trunk. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14254 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
41
tests/regressiontests/generic_views/models.py
Normal file
41
tests/regressiontests/generic_views/models.py
Normal file
@@ -0,0 +1,41 @@
|
||||
from django.db import models
|
||||
|
||||
class Artist(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
class Meta:
|
||||
ordering = ['name']
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('artist_detail', (), {'pk': self.id})
|
||||
|
||||
class Author(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
slug = models.SlugField()
|
||||
|
||||
class Meta:
|
||||
ordering = ['name']
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
class Book(models.Model):
|
||||
name = models.CharField(max_length=300)
|
||||
slug = models.SlugField()
|
||||
pages = models.IntegerField()
|
||||
authors = models.ManyToManyField(Author)
|
||||
pubdate = models.DateField()
|
||||
|
||||
class Meta:
|
||||
ordering = ['-pubdate']
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
|
||||
class Page(models.Model):
|
||||
content = models.TextField()
|
||||
template = models.CharField(max_length=300)
|
||||
Reference in New Issue
Block a user