2008-12-16 18:42:18 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2009-12-22 19:29:00 +01:00
|
|
|
import datetime
|
2009-04-18 22:29:55 +02:00
|
|
|
import tempfile
|
|
|
|
import os
|
2009-12-22 19:29:00 +01:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
from django.contrib import admin
|
2009-12-22 19:29:00 +01:00
|
|
|
from django.core.files.storage import FileSystemStorage
|
2009-12-18 11:08:05 +01:00
|
|
|
from django.contrib.admin.views.main import ChangeList
|
2009-03-23 21:22:56 +01:00
|
|
|
from django.core.mail import EmailMessage
|
2009-12-22 19:29:00 +01:00
|
|
|
from django.db import models
|
2010-02-16 13:17:37 +01:00
|
|
|
from django import forms
|
|
|
|
from django.forms.models import BaseModelFormSet
|
2010-08-06 16:58:05 +02:00
|
|
|
from django.contrib.auth.models import User
|
2010-02-26 14:17:43 +01:00
|
|
|
from django.contrib.contenttypes import generic
|
|
|
|
from django.contrib.contenttypes.models import ContentType
|
2008-07-19 01:54:34 +02:00
|
|
|
|
|
|
|
class Section(models.Model):
|
|
|
|
"""
|
2008-08-08 20:07:33 +02:00
|
|
|
A simple section that links to articles, to test linking to related items
|
2008-07-19 01:54:34 +02:00
|
|
|
in admin views.
|
|
|
|
"""
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Article(models.Model):
|
|
|
|
"""
|
|
|
|
A simple article to test admin views. Test backwards compatibility.
|
|
|
|
"""
|
2008-08-08 20:07:33 +02:00
|
|
|
title = models.CharField(max_length=100)
|
2008-07-19 01:54:34 +02:00
|
|
|
content = models.TextField()
|
|
|
|
date = models.DateTimeField()
|
2010-03-16 20:01:40 +01:00
|
|
|
section = models.ForeignKey(Section, null=True, blank=True)
|
2008-07-19 01:54:34 +02:00
|
|
|
|
2008-08-08 20:07:33 +02:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
2009-03-10 12:19:26 +01:00
|
|
|
|
2008-10-08 16:47:01 +02:00
|
|
|
def model_year(self):
|
|
|
|
return self.date.year
|
|
|
|
model_year.admin_order_field = 'date'
|
2010-03-16 17:10:27 +01:00
|
|
|
model_year.short_description = ''
|
2008-10-08 16:47:01 +02:00
|
|
|
|
2008-12-16 16:04:47 +01:00
|
|
|
class Book(models.Model):
|
|
|
|
"""
|
|
|
|
A simple book that has chapters.
|
|
|
|
"""
|
2008-12-16 18:42:18 +01:00
|
|
|
name = models.CharField(max_length=100, verbose_name=u'¿Name?')
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Promo(models.Model):
|
|
|
|
name = models.CharField(max_length=100, verbose_name=u'¿Name?')
|
|
|
|
book = models.ForeignKey(Book)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
2008-12-16 16:04:47 +01:00
|
|
|
|
|
|
|
class Chapter(models.Model):
|
2008-12-16 18:42:18 +01:00
|
|
|
title = models.CharField(max_length=100, verbose_name=u'¿Title?')
|
2008-12-16 16:04:47 +01:00
|
|
|
content = models.TextField()
|
|
|
|
book = models.ForeignKey(Book)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
2008-12-16 18:42:18 +01:00
|
|
|
class Meta:
|
2010-03-02 04:28:48 +01:00
|
|
|
# Use a utf-8 bytestring to ensure it works (see #11710)
|
|
|
|
verbose_name = '¿Chapter?'
|
2008-12-16 18:42:18 +01:00
|
|
|
|
|
|
|
class ChapterXtra1(models.Model):
|
|
|
|
chap = models.OneToOneField(Chapter, verbose_name=u'¿Chap?')
|
2009-03-10 12:19:26 +01:00
|
|
|
xtra = models.CharField(max_length=100, verbose_name=u'¿Xtra?')
|
2008-12-16 18:42:18 +01:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return u'¿Xtra1: %s' % self.xtra
|
|
|
|
|
|
|
|
class ChapterXtra2(models.Model):
|
|
|
|
chap = models.OneToOneField(Chapter, verbose_name=u'¿Chap?')
|
2009-03-10 12:19:26 +01:00
|
|
|
xtra = models.CharField(max_length=100, verbose_name=u'¿Xtra?')
|
2008-12-16 18:42:18 +01:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return u'¿Xtra2: %s' % self.xtra
|
|
|
|
|
2008-10-08 16:47:01 +02:00
|
|
|
def callable_year(dt_value):
|
|
|
|
return dt_value.year
|
|
|
|
callable_year.admin_order_field = 'date'
|
2008-08-08 20:07:33 +02:00
|
|
|
|
2008-08-09 22:52:40 +02:00
|
|
|
class ArticleInline(admin.TabularInline):
|
|
|
|
model = Article
|
|
|
|
|
2008-12-16 16:04:47 +01:00
|
|
|
class ChapterInline(admin.TabularInline):
|
|
|
|
model = Chapter
|
|
|
|
|
2010-11-21 20:29:15 +01:00
|
|
|
class ChapterXtra1Admin(admin.ModelAdmin):
|
|
|
|
list_filter = ('chap',
|
|
|
|
'chap__title',
|
|
|
|
'chap__book',
|
|
|
|
'chap__book__name',
|
|
|
|
'chap__book__promo',
|
|
|
|
'chap__book__promo__name',)
|
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
class ArticleAdmin(admin.ModelAdmin):
|
2008-10-08 16:47:01 +02:00
|
|
|
list_display = ('content', 'date', callable_year, 'model_year', 'modeladmin_year')
|
2010-12-23 04:44:38 +01:00
|
|
|
list_filter = ('date', 'section')
|
2008-08-08 20:07:33 +02:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
def changelist_view(self, request):
|
|
|
|
"Test that extra_context works"
|
|
|
|
return super(ArticleAdmin, self).changelist_view(
|
|
|
|
request, extra_context={
|
|
|
|
'extra_var': 'Hello!'
|
|
|
|
}
|
|
|
|
)
|
2009-03-10 12:19:26 +01:00
|
|
|
|
2008-10-08 16:47:01 +02:00
|
|
|
def modeladmin_year(self, obj):
|
|
|
|
return obj.date.year
|
|
|
|
modeladmin_year.admin_order_field = 'date'
|
2010-03-16 17:10:27 +01:00
|
|
|
modeladmin_year.short_description = None
|
2008-07-19 01:54:34 +02:00
|
|
|
|
2010-11-21 20:00:40 +01:00
|
|
|
def delete_model(self, request, obj):
|
|
|
|
EmailMessage(
|
|
|
|
'Greetings from a deleted object',
|
|
|
|
'I hereby inform you that some user deleted me',
|
|
|
|
'from@example.com',
|
|
|
|
['to@example.com']
|
|
|
|
).send()
|
|
|
|
return super(ArticleAdmin, self).delete_model(request, obj)
|
|
|
|
|
|
|
|
def save_model(self, request, obj, form, change=True):
|
|
|
|
EmailMessage(
|
|
|
|
'Greetings from a created object',
|
|
|
|
'I hereby inform you that some user created me',
|
|
|
|
'from@example.com',
|
|
|
|
['to@example.com']
|
|
|
|
).send()
|
|
|
|
return super(ArticleAdmin, self).save_model(request, obj, form, change)
|
|
|
|
|
2011-02-19 15:05:07 +01:00
|
|
|
class RowLevelChangePermissionModel(models.Model):
|
|
|
|
name = models.CharField(max_length=100, blank=True)
|
|
|
|
|
|
|
|
class RowLevelChangePermissionModelAdmin(admin.ModelAdmin):
|
|
|
|
def has_change_permission(self, request, obj=None):
|
|
|
|
""" Only allow changing objects with even id number """
|
|
|
|
return request.user.is_staff and (obj is not None) and (obj.id % 2 == 0)
|
2010-11-21 20:00:40 +01:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
class CustomArticle(models.Model):
|
|
|
|
content = models.TextField()
|
|
|
|
date = models.DateTimeField()
|
|
|
|
|
|
|
|
class CustomArticleAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
Tests various hooks for using custom templates and contexts.
|
|
|
|
"""
|
|
|
|
change_list_template = 'custom_admin/change_list.html'
|
|
|
|
change_form_template = 'custom_admin/change_form.html'
|
2010-01-13 00:34:03 +01:00
|
|
|
add_form_template = 'custom_admin/add_form.html'
|
2008-07-19 01:54:34 +02:00
|
|
|
object_history_template = 'custom_admin/object_history.html'
|
|
|
|
delete_confirmation_template = 'custom_admin/delete_confirmation.html'
|
2010-04-05 14:02:27 +02:00
|
|
|
delete_selected_confirmation_template = 'custom_admin/delete_selected_confirmation.html'
|
2008-08-08 20:07:33 +02:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
def changelist_view(self, request):
|
|
|
|
"Test that extra_context works"
|
|
|
|
return super(CustomArticleAdmin, self).changelist_view(
|
|
|
|
request, extra_context={
|
|
|
|
'extra_var': 'Hello!'
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
class ModelWithStringPrimaryKey(models.Model):
|
|
|
|
id = models.CharField(max_length=255, primary_key=True)
|
2008-08-08 20:07:33 +02:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.id
|
2008-08-08 20:07:33 +02:00
|
|
|
|
2008-10-21 21:03:21 +02:00
|
|
|
class Color(models.Model):
|
|
|
|
value = models.CharField(max_length=10)
|
2009-03-10 12:19:26 +01:00
|
|
|
warm = models.BooleanField()
|
2008-10-21 21:03:21 +02:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.value
|
|
|
|
|
|
|
|
class Thing(models.Model):
|
|
|
|
title = models.CharField(max_length=20)
|
|
|
|
color = models.ForeignKey(Color, limit_choices_to={'warm': True})
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
|
|
|
class ThingAdmin(admin.ModelAdmin):
|
2011-01-03 14:56:31 +01:00
|
|
|
list_filter = ('color__warm', 'color__value')
|
2008-10-21 21:03:21 +02:00
|
|
|
|
2011-01-28 15:08:25 +01:00
|
|
|
class Actor(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
age = models.IntegerField()
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Inquisition(models.Model):
|
|
|
|
expected = models.BooleanField()
|
|
|
|
leader = models.ForeignKey(Actor)
|
2011-01-28 15:08:42 +01:00
|
|
|
country = models.CharField(max_length=20)
|
|
|
|
|
2011-01-28 15:08:25 +01:00
|
|
|
def __unicode__(self):
|
2011-01-28 15:08:42 +01:00
|
|
|
return u"by %s from %s" % (self.leader, self.country)
|
|
|
|
|
|
|
|
class InquisitionAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('leader', 'country', 'expected')
|
2011-01-28 15:08:25 +01:00
|
|
|
|
|
|
|
class Sketch(models.Model):
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
inquisition = models.ForeignKey(Inquisition, limit_choices_to={'leader__name': 'Palin',
|
|
|
|
'leader__age': 27,
|
2011-01-28 15:08:42 +01:00
|
|
|
'expected': False,
|
2011-01-28 15:08:25 +01:00
|
|
|
})
|
2011-01-28 15:08:42 +01:00
|
|
|
|
2011-01-28 15:08:25 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.title
|
|
|
|
|
2011-01-28 15:08:42 +01:00
|
|
|
class SketchAdmin(admin.ModelAdmin):
|
|
|
|
raw_id_fields = ('inquisition',)
|
|
|
|
|
2009-04-01 16:14:20 +02:00
|
|
|
class Fabric(models.Model):
|
|
|
|
NG_CHOICES = (
|
|
|
|
('Textured', (
|
|
|
|
('x', 'Horizontal'),
|
|
|
|
('y', 'Vertical'),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
('plain', 'Smooth'),
|
|
|
|
)
|
|
|
|
surface = models.CharField(max_length=20, choices=NG_CHOICES)
|
|
|
|
|
|
|
|
class FabricAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('surface',)
|
|
|
|
list_filter = ('surface',)
|
|
|
|
|
2009-03-17 21:51:47 +01:00
|
|
|
class Person(models.Model):
|
|
|
|
GENDER_CHOICES = (
|
|
|
|
(1, "Male"),
|
|
|
|
(2, "Female"),
|
|
|
|
)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
gender = models.IntegerField(choices=GENDER_CHOICES)
|
2011-01-03 14:56:31 +01:00
|
|
|
age = models.IntegerField(default=21)
|
2009-03-17 21:51:47 +01:00
|
|
|
alive = models.BooleanField()
|
2009-03-29 20:52:38 +02:00
|
|
|
|
2009-03-17 21:51:47 +01:00
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
2009-03-29 20:52:38 +02:00
|
|
|
|
2010-02-16 13:17:37 +01:00
|
|
|
class BasePersonModelFormSet(BaseModelFormSet):
|
|
|
|
def clean(self):
|
|
|
|
for person_dict in self.cleaned_data:
|
|
|
|
person = person_dict.get('id')
|
|
|
|
alive = person_dict.get('alive')
|
|
|
|
if person and alive and person.name == "Grace Hopper":
|
2011-03-15 00:00:03 +01:00
|
|
|
raise forms.ValidationError("Grace is not a Zombie")
|
2010-02-16 13:17:37 +01:00
|
|
|
|
2009-03-17 21:51:47 +01:00
|
|
|
class PersonAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('name', 'gender', 'alive')
|
|
|
|
list_editable = ('gender', 'alive')
|
|
|
|
list_filter = ('gender',)
|
2011-03-01 03:04:35 +01:00
|
|
|
search_fields = ('^name',)
|
2009-05-08 14:53:14 +02:00
|
|
|
save_as = True
|
2009-03-17 21:51:47 +01:00
|
|
|
|
2010-02-16 13:17:37 +01:00
|
|
|
def get_changelist_formset(self, request, **kwargs):
|
|
|
|
return super(PersonAdmin, self).get_changelist_formset(request,
|
|
|
|
formset=BasePersonModelFormSet, **kwargs)
|
|
|
|
|
2011-06-02 18:18:47 +02:00
|
|
|
def queryset(self, request):
|
|
|
|
# Order by a field that isn't in list display, to be able to test
|
|
|
|
# whether ordering is preserved.
|
|
|
|
return super(PersonAdmin, self).queryset(request).order_by('age')
|
|
|
|
|
2010-02-16 13:17:37 +01:00
|
|
|
|
2009-03-10 12:19:26 +01:00
|
|
|
class Persona(models.Model):
|
|
|
|
"""
|
|
|
|
A simple persona associated with accounts, to test inlining of related
|
|
|
|
accounts which inherit from a common accounts class.
|
|
|
|
"""
|
|
|
|
name = models.CharField(blank=False, max_length=80)
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Account(models.Model):
|
|
|
|
"""
|
|
|
|
A simple, generic account encapsulating the information shared by all
|
|
|
|
types of accounts.
|
|
|
|
"""
|
|
|
|
username = models.CharField(blank=False, max_length=80)
|
|
|
|
persona = models.ForeignKey(Persona, related_name="accounts")
|
|
|
|
servicename = u'generic service'
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return "%s: %s" % (self.servicename, self.username)
|
|
|
|
|
|
|
|
class FooAccount(Account):
|
|
|
|
"""A service-specific account of type Foo."""
|
|
|
|
servicename = u'foo'
|
|
|
|
|
|
|
|
class BarAccount(Account):
|
|
|
|
"""A service-specific account of type Bar."""
|
|
|
|
servicename = u'bar'
|
|
|
|
|
|
|
|
class FooAccountAdmin(admin.StackedInline):
|
|
|
|
model = FooAccount
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
class BarAccountAdmin(admin.StackedInline):
|
|
|
|
model = BarAccount
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
class PersonaAdmin(admin.ModelAdmin):
|
|
|
|
inlines = (
|
|
|
|
FooAccountAdmin,
|
|
|
|
BarAccountAdmin
|
|
|
|
)
|
|
|
|
|
2009-03-23 21:22:56 +01:00
|
|
|
class Subscriber(models.Model):
|
|
|
|
name = models.CharField(blank=False, max_length=80)
|
|
|
|
email = models.EmailField(blank=False, max_length=175)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return "%s (%s)" % (self.name, self.email)
|
|
|
|
|
|
|
|
class SubscriberAdmin(admin.ModelAdmin):
|
2009-04-06 22:23:33 +02:00
|
|
|
actions = ['mail_admin']
|
2009-03-23 21:22:56 +01:00
|
|
|
|
|
|
|
def mail_admin(self, request, selected):
|
|
|
|
EmailMessage(
|
|
|
|
'Greetings from a ModelAdmin action',
|
|
|
|
'This is the test email from a admin action',
|
|
|
|
'from@example.com',
|
|
|
|
['to@example.com']
|
|
|
|
).send()
|
|
|
|
|
|
|
|
class ExternalSubscriber(Subscriber):
|
|
|
|
pass
|
|
|
|
|
2009-04-06 22:23:33 +02:00
|
|
|
class OldSubscriber(Subscriber):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def external_mail(modeladmin, request, selected):
|
2009-03-23 21:22:56 +01:00
|
|
|
EmailMessage(
|
|
|
|
'Greetings from a function action',
|
|
|
|
'This is the test email from a function action',
|
|
|
|
'from@example.com',
|
|
|
|
['to@example.com']
|
|
|
|
).send()
|
2011-05-06 00:03:17 +02:00
|
|
|
external_mail.short_description = 'External mail (Another awesome action)'
|
2009-03-23 21:22:56 +01:00
|
|
|
|
2009-04-06 22:23:33 +02:00
|
|
|
def redirect_to(modeladmin, request, selected):
|
2009-03-23 21:22:56 +01:00
|
|
|
from django.http import HttpResponseRedirect
|
|
|
|
return HttpResponseRedirect('/some-where-else/')
|
2011-05-06 00:03:17 +02:00
|
|
|
redirect_to.short_description = 'Redirect to (Awesome action)'
|
2009-03-23 21:22:56 +01:00
|
|
|
|
|
|
|
class ExternalSubscriberAdmin(admin.ModelAdmin):
|
2011-05-06 00:03:17 +02:00
|
|
|
actions = [redirect_to, external_mail]
|
2009-03-17 21:51:47 +01:00
|
|
|
|
2009-03-29 20:52:38 +02:00
|
|
|
class Media(models.Model):
|
|
|
|
name = models.CharField(max_length=60)
|
|
|
|
|
|
|
|
class Podcast(Media):
|
|
|
|
release_date = models.DateField()
|
|
|
|
|
2011-06-02 18:18:47 +02:00
|
|
|
class Meta:
|
|
|
|
ordering = ('release_date',) # overridden in PodcastAdmin
|
|
|
|
|
2009-03-29 20:52:38 +02:00
|
|
|
class PodcastAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('name', 'release_date')
|
|
|
|
list_editable = ('release_date',)
|
2010-12-12 23:54:50 +01:00
|
|
|
date_hierarchy = 'release_date'
|
2009-03-29 20:52:38 +02:00
|
|
|
ordering = ('name',)
|
|
|
|
|
2009-04-18 23:03:29 +02:00
|
|
|
class Vodcast(Media):
|
|
|
|
media = models.OneToOneField(Media, primary_key=True, parent_link=True)
|
|
|
|
released = models.BooleanField(default=False)
|
|
|
|
|
|
|
|
class VodcastAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('name', 'released')
|
|
|
|
list_editable = ('released',)
|
|
|
|
|
|
|
|
ordering = ('name',)
|
|
|
|
|
2009-03-31 02:03:34 +02:00
|
|
|
class Parent(models.Model):
|
|
|
|
name = models.CharField(max_length=128)
|
|
|
|
|
|
|
|
class Child(models.Model):
|
|
|
|
parent = models.ForeignKey(Parent, editable=False)
|
|
|
|
name = models.CharField(max_length=30, blank=True)
|
|
|
|
|
|
|
|
class ChildInline(admin.StackedInline):
|
|
|
|
model = Child
|
|
|
|
|
|
|
|
class ParentAdmin(admin.ModelAdmin):
|
|
|
|
model = Parent
|
|
|
|
inlines = [ChildInline]
|
|
|
|
|
2009-04-01 05:11:58 +02:00
|
|
|
class EmptyModel(models.Model):
|
|
|
|
def __unicode__(self):
|
|
|
|
return "Primary key = %s" % self.id
|
|
|
|
|
|
|
|
class EmptyModelAdmin(admin.ModelAdmin):
|
|
|
|
def queryset(self, request):
|
|
|
|
return super(EmptyModelAdmin, self).queryset(request).filter(pk__gt=1)
|
|
|
|
|
2009-04-06 22:23:33 +02:00
|
|
|
class OldSubscriberAdmin(admin.ModelAdmin):
|
|
|
|
actions = None
|
|
|
|
|
2009-04-18 22:29:55 +02:00
|
|
|
temp_storage = FileSystemStorage(tempfile.mkdtemp())
|
|
|
|
UPLOAD_TO = os.path.join(temp_storage.location, 'test_upload')
|
|
|
|
|
|
|
|
class Gallery(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Picture(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
image = models.FileField(storage=temp_storage, upload_to='test_upload')
|
|
|
|
gallery = models.ForeignKey(Gallery, related_name="pictures")
|
|
|
|
|
|
|
|
class PictureInline(admin.TabularInline):
|
|
|
|
model = Picture
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
class GalleryAdmin(admin.ModelAdmin):
|
|
|
|
inlines = [PictureInline]
|
|
|
|
|
|
|
|
class PictureAdmin(admin.ModelAdmin):
|
|
|
|
pass
|
|
|
|
|
2009-05-07 13:56:10 +02:00
|
|
|
class Language(models.Model):
|
|
|
|
iso = models.CharField(max_length=5, primary_key=True)
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
english_name = models.CharField(max_length=50)
|
|
|
|
shortlist = models.BooleanField(default=False)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('iso',)
|
|
|
|
|
|
|
|
class LanguageAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ['iso', 'shortlist', 'english_name', 'name']
|
|
|
|
list_editable = ['shortlist']
|
|
|
|
|
2009-05-07 14:52:43 +02:00
|
|
|
# a base class for Recommender and Recommendation
|
|
|
|
class Title(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class TitleTranslation(models.Model):
|
|
|
|
title = models.ForeignKey(Title)
|
|
|
|
text = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Recommender(Title):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class Recommendation(Title):
|
|
|
|
recommender = models.ForeignKey(Recommender)
|
|
|
|
|
|
|
|
class RecommendationAdmin(admin.ModelAdmin):
|
2011-03-01 03:04:35 +01:00
|
|
|
search_fields = ('=titletranslation__text', '=recommender__titletranslation__text',)
|
2009-05-07 14:52:43 +02:00
|
|
|
|
2009-05-09 13:40:13 +02:00
|
|
|
class Collector(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Widget(models.Model):
|
|
|
|
owner = models.ForeignKey(Collector)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class DooHickey(models.Model):
|
|
|
|
code = models.CharField(max_length=10, primary_key=True)
|
|
|
|
owner = models.ForeignKey(Collector)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Grommet(models.Model):
|
|
|
|
code = models.AutoField(primary_key=True)
|
|
|
|
owner = models.ForeignKey(Collector)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Whatsit(models.Model):
|
|
|
|
index = models.IntegerField(primary_key=True)
|
|
|
|
owner = models.ForeignKey(Collector)
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Doodad(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class FancyDoodad(Doodad):
|
|
|
|
owner = models.ForeignKey(Collector)
|
|
|
|
expensive = models.BooleanField(default=True)
|
|
|
|
|
|
|
|
class WidgetInline(admin.StackedInline):
|
|
|
|
model = Widget
|
|
|
|
|
|
|
|
class DooHickeyInline(admin.StackedInline):
|
|
|
|
model = DooHickey
|
|
|
|
|
|
|
|
class GrommetInline(admin.StackedInline):
|
|
|
|
model = Grommet
|
|
|
|
|
|
|
|
class WhatsitInline(admin.StackedInline):
|
|
|
|
model = Whatsit
|
|
|
|
|
|
|
|
class FancyDoodadInline(admin.StackedInline):
|
|
|
|
model = FancyDoodad
|
|
|
|
|
2009-07-03 05:05:17 +02:00
|
|
|
class Category(models.Model):
|
|
|
|
collector = models.ForeignKey(Collector)
|
|
|
|
order = models.PositiveIntegerField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('order',)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return u'%s:o%s' % (self.id, self.order)
|
|
|
|
|
|
|
|
class CategoryAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('id', 'collector', 'order')
|
|
|
|
list_editable = ('order',)
|
|
|
|
|
|
|
|
class CategoryInline(admin.StackedInline):
|
|
|
|
model = Category
|
|
|
|
|
2009-05-09 13:40:13 +02:00
|
|
|
class CollectorAdmin(admin.ModelAdmin):
|
2009-12-22 19:29:00 +01:00
|
|
|
inlines = [
|
|
|
|
WidgetInline, DooHickeyInline, GrommetInline, WhatsitInline,
|
|
|
|
FancyDoodadInline, CategoryInline
|
|
|
|
]
|
|
|
|
|
|
|
|
class Link(models.Model):
|
|
|
|
posted = models.DateField(
|
|
|
|
default=lambda: datetime.date.today() - datetime.timedelta(days=7)
|
|
|
|
)
|
|
|
|
url = models.URLField()
|
|
|
|
post = models.ForeignKey("Post")
|
|
|
|
|
|
|
|
|
|
|
|
class LinkInline(admin.TabularInline):
|
|
|
|
model = Link
|
|
|
|
extra = 1
|
|
|
|
|
|
|
|
readonly_fields = ("posted",)
|
|
|
|
|
|
|
|
|
2011-04-22 14:02:25 +02:00
|
|
|
class PrePopulatedPost(models.Model):
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
published = models.BooleanField()
|
|
|
|
slug = models.SlugField()
|
|
|
|
|
|
|
|
class PrePopulatedSubPost(models.Model):
|
|
|
|
post = models.ForeignKey(PrePopulatedPost)
|
|
|
|
subtitle = models.CharField(max_length=100)
|
|
|
|
subslug = models.SlugField()
|
|
|
|
|
|
|
|
class SubPostInline(admin.TabularInline):
|
|
|
|
model = PrePopulatedSubPost
|
|
|
|
|
|
|
|
prepopulated_fields = {
|
|
|
|
'subslug' : ('subtitle',)
|
|
|
|
}
|
|
|
|
|
|
|
|
def get_readonly_fields(self, request, obj=None):
|
|
|
|
if obj and obj.published:
|
|
|
|
return ('subslug',)
|
|
|
|
return self.readonly_fields
|
|
|
|
|
|
|
|
def get_prepopulated_fields(self, request, obj=None):
|
|
|
|
if obj and obj.published:
|
|
|
|
return {}
|
|
|
|
return self.prepopulated_fields
|
|
|
|
|
|
|
|
class PrePopulatedPostAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ['title', 'slug']
|
|
|
|
prepopulated_fields = {
|
|
|
|
'slug' : ('title',)
|
|
|
|
}
|
|
|
|
|
|
|
|
inlines = [SubPostInline]
|
|
|
|
|
|
|
|
def get_readonly_fields(self, request, obj=None):
|
|
|
|
if obj and obj.published:
|
|
|
|
return ('slug',)
|
|
|
|
return self.readonly_fields
|
|
|
|
|
|
|
|
def get_prepopulated_fields(self, request, obj=None):
|
|
|
|
if obj and obj.published:
|
|
|
|
return {}
|
|
|
|
return self.prepopulated_fields
|
|
|
|
|
2009-12-22 19:29:00 +01:00
|
|
|
class Post(models.Model):
|
2011-02-19 13:55:09 +01:00
|
|
|
title = models.CharField(max_length=100, help_text="Some help text for the title (with unicode ŠĐĆŽćžšđ)")
|
|
|
|
content = models.TextField(help_text="Some help text for the content (with unicode ŠĐĆŽćžšđ)")
|
|
|
|
posted = models.DateField(
|
|
|
|
default=datetime.date.today,
|
|
|
|
help_text="Some help text for the date (with unicode ŠĐĆŽćžšđ)"
|
|
|
|
)
|
2010-03-10 09:37:17 +01:00
|
|
|
public = models.NullBooleanField()
|
2009-12-22 19:29:00 +01:00
|
|
|
|
|
|
|
def awesomeness_level(self):
|
|
|
|
return "Very awesome."
|
|
|
|
|
|
|
|
class PostAdmin(admin.ModelAdmin):
|
2010-03-10 09:37:17 +01:00
|
|
|
list_display = ['title', 'public']
|
2010-04-11 10:35:04 +02:00
|
|
|
readonly_fields = ('posted', 'awesomeness_level', 'coolness', 'value', lambda obj: "foo")
|
2009-12-22 19:29:00 +01:00
|
|
|
|
|
|
|
inlines = [
|
|
|
|
LinkInline
|
|
|
|
]
|
|
|
|
|
|
|
|
def coolness(self, instance):
|
|
|
|
if instance.pk:
|
|
|
|
return "%d amount of cool." % instance.pk
|
|
|
|
else:
|
|
|
|
return "Unkown coolness."
|
|
|
|
|
2010-04-11 10:35:04 +02:00
|
|
|
def value(self, instance):
|
|
|
|
return 1000
|
|
|
|
value.short_description = 'Value in $US'
|
2009-05-07 14:52:43 +02:00
|
|
|
|
2009-12-18 11:08:05 +01:00
|
|
|
class Gadget(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class CustomChangeList(ChangeList):
|
2011-05-03 12:44:23 +02:00
|
|
|
def get_query_set(self, request):
|
2009-12-18 11:08:05 +01:00
|
|
|
return self.root_query_set.filter(pk=9999) # Does not exist
|
|
|
|
|
|
|
|
class GadgetAdmin(admin.ModelAdmin):
|
|
|
|
def get_changelist(self, request, **kwargs):
|
|
|
|
return CustomChangeList
|
|
|
|
|
2010-02-26 14:17:43 +01:00
|
|
|
class Villain(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class SuperVillain(Villain):
|
|
|
|
pass
|
|
|
|
|
|
|
|
class FunkyTag(models.Model):
|
|
|
|
"Because we all know there's only one real use case for GFKs."
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
content_type = models.ForeignKey(ContentType)
|
|
|
|
object_id = models.PositiveIntegerField()
|
|
|
|
content_object = generic.GenericForeignKey('content_type', 'object_id')
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class Plot(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
team_leader = models.ForeignKey(Villain, related_name='lead_plots')
|
|
|
|
contact = models.ForeignKey(Villain, related_name='contact_plots')
|
|
|
|
tags = generic.GenericRelation(FunkyTag)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class PlotDetails(models.Model):
|
|
|
|
details = models.CharField(max_length=100)
|
|
|
|
plot = models.OneToOneField(Plot)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.details
|
|
|
|
|
|
|
|
class SecretHideout(models.Model):
|
|
|
|
""" Secret! Not registered with the admin! """
|
|
|
|
location = models.CharField(max_length=100)
|
|
|
|
villain = models.ForeignKey(Villain)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.location
|
|
|
|
|
|
|
|
class SuperSecretHideout(models.Model):
|
|
|
|
""" Secret! Not registered with the admin! """
|
|
|
|
location = models.CharField(max_length=100)
|
|
|
|
supervillain = models.ForeignKey(SuperVillain)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.location
|
|
|
|
|
|
|
|
class CyclicOne(models.Model):
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
two = models.ForeignKey('CyclicTwo')
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
class CyclicTwo(models.Model):
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
one = models.ForeignKey(CyclicOne)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2010-03-21 15:23:25 +01:00
|
|
|
class Topping(models.Model):
|
2010-04-11 10:35:04 +02:00
|
|
|
name = models.CharField(max_length=20)
|
2010-03-21 15:23:25 +01:00
|
|
|
|
|
|
|
class Pizza(models.Model):
|
|
|
|
name = models.CharField(max_length=20)
|
|
|
|
toppings = models.ManyToManyField('Topping')
|
|
|
|
|
|
|
|
class PizzaAdmin(admin.ModelAdmin):
|
|
|
|
readonly_fields = ('toppings',)
|
|
|
|
|
2010-08-06 16:58:05 +02:00
|
|
|
class Album(models.Model):
|
|
|
|
owner = models.ForeignKey(User)
|
|
|
|
title = models.CharField(max_length=30)
|
|
|
|
|
2010-12-23 04:44:38 +01:00
|
|
|
class AlbumAdmin(admin.ModelAdmin):
|
|
|
|
list_filter = ['title']
|
|
|
|
|
2011-01-13 00:30:47 +01:00
|
|
|
class Employee(Person):
|
|
|
|
code = models.CharField(max_length=20)
|
|
|
|
|
|
|
|
class WorkHour(models.Model):
|
|
|
|
datum = models.DateField()
|
|
|
|
employee = models.ForeignKey(Employee)
|
|
|
|
|
|
|
|
class WorkHourAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('datum', 'employee')
|
|
|
|
list_filter = ('employee',)
|
|
|
|
|
2011-01-20 01:33:32 +01:00
|
|
|
class Question(models.Model):
|
|
|
|
question = models.CharField(max_length=20)
|
|
|
|
|
|
|
|
class Answer(models.Model):
|
|
|
|
question = models.ForeignKey(Question, on_delete=models.PROTECT)
|
|
|
|
answer = models.CharField(max_length=20)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.answer
|
|
|
|
|
2011-02-08 13:00:21 +01:00
|
|
|
class Reservation(models.Model):
|
|
|
|
start_date = models.DateTimeField()
|
|
|
|
price = models.IntegerField()
|
2011-02-19 12:48:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
DRIVER_CHOICES = (
|
|
|
|
(u'bill', 'Bill G'),
|
|
|
|
(u'steve', 'Steve J'),
|
|
|
|
)
|
|
|
|
|
|
|
|
RESTAURANT_CHOICES = (
|
|
|
|
(u'indian', u'A Taste of India'),
|
|
|
|
(u'thai', u'Thai Pography'),
|
|
|
|
(u'pizza', u'Pizza Mama'),
|
|
|
|
)
|
|
|
|
|
|
|
|
class FoodDelivery(models.Model):
|
|
|
|
reference = models.CharField(max_length=100)
|
|
|
|
driver = models.CharField(max_length=100, choices=DRIVER_CHOICES, blank=True)
|
|
|
|
restaurant = models.CharField(max_length=100, choices=RESTAURANT_CHOICES, blank=True)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
unique_together = (("driver", "restaurant"),)
|
|
|
|
|
|
|
|
class FoodDeliveryAdmin(admin.ModelAdmin):
|
|
|
|
list_display=('reference', 'driver', 'restaurant')
|
|
|
|
list_editable = ('driver', 'restaurant')
|
|
|
|
|
2011-02-21 00:09:25 +01:00
|
|
|
class Paper(models.Model):
|
|
|
|
title = models.CharField(max_length=30)
|
|
|
|
author = models.CharField(max_length=30, blank=True, null=True)
|
|
|
|
|
|
|
|
class CoverLetter(models.Model):
|
|
|
|
author = models.CharField(max_length=30)
|
2011-03-08 20:26:32 +01:00
|
|
|
date_written = models.DateField(null=True, blank=True)
|
2011-02-21 00:09:25 +01:00
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.author
|
|
|
|
|
|
|
|
class PaperAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
A ModelAdin with a custom queryset() method that uses only(), to test
|
|
|
|
verbose_name display in messages shown after adding Paper instances.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def queryset(self, request):
|
|
|
|
return super(PaperAdmin, self).queryset(request).only('title')
|
|
|
|
|
|
|
|
class CoverLetterAdmin(admin.ModelAdmin):
|
|
|
|
"""
|
|
|
|
A ModelAdin with a custom queryset() method that uses only(), to test
|
|
|
|
verbose_name display in messages shown after adding CoverLetter instances.
|
|
|
|
Note that the CoverLetter model defines a __unicode__ method.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def queryset(self, request):
|
|
|
|
#return super(CoverLetterAdmin, self).queryset(request).only('author')
|
2011-03-08 20:26:32 +01:00
|
|
|
return super(CoverLetterAdmin, self).queryset(request).defer('date_written')
|
2011-02-21 00:09:25 +01:00
|
|
|
|
2011-03-03 14:20:45 +01:00
|
|
|
class Story(models.Model):
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
content = models.TextField()
|
|
|
|
|
|
|
|
class StoryForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
widgets = {'title': forms.HiddenInput}
|
|
|
|
|
|
|
|
class StoryAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('id', 'title', 'content')
|
|
|
|
list_display_links = ('title',) # 'id' not in list_display_links
|
|
|
|
list_editable = ('content', )
|
|
|
|
form = StoryForm
|
2011-06-02 18:18:47 +02:00
|
|
|
ordering = ["-pk"]
|
2011-03-03 14:20:45 +01:00
|
|
|
|
|
|
|
class OtherStory(models.Model):
|
|
|
|
title = models.CharField(max_length=100)
|
|
|
|
content = models.TextField()
|
|
|
|
|
|
|
|
class OtherStoryAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('id', 'title', 'content')
|
|
|
|
list_display_links = ('title', 'id') # 'id' in list_display_links
|
|
|
|
list_editable = ('content', )
|
2011-06-02 18:18:47 +02:00
|
|
|
ordering = ["-pk"]
|
2011-02-19 12:48:42 +01:00
|
|
|
|
2008-07-19 01:54:34 +02:00
|
|
|
admin.site.register(Article, ArticleAdmin)
|
|
|
|
admin.site.register(CustomArticle, CustomArticleAdmin)
|
2009-04-02 02:01:15 +02:00
|
|
|
admin.site.register(Section, save_as=True, inlines=[ArticleInline])
|
2008-07-19 01:54:34 +02:00
|
|
|
admin.site.register(ModelWithStringPrimaryKey)
|
2008-10-21 21:03:21 +02:00
|
|
|
admin.site.register(Color)
|
|
|
|
admin.site.register(Thing, ThingAdmin)
|
2011-01-28 15:08:25 +01:00
|
|
|
admin.site.register(Actor)
|
2011-01-28 15:08:42 +01:00
|
|
|
admin.site.register(Inquisition, InquisitionAdmin)
|
|
|
|
admin.site.register(Sketch, SketchAdmin)
|
2009-03-17 21:51:47 +01:00
|
|
|
admin.site.register(Person, PersonAdmin)
|
2009-03-10 12:19:26 +01:00
|
|
|
admin.site.register(Persona, PersonaAdmin)
|
2009-03-23 21:22:56 +01:00
|
|
|
admin.site.register(Subscriber, SubscriberAdmin)
|
|
|
|
admin.site.register(ExternalSubscriber, ExternalSubscriberAdmin)
|
2009-04-06 22:23:33 +02:00
|
|
|
admin.site.register(OldSubscriber, OldSubscriberAdmin)
|
2009-03-29 20:52:38 +02:00
|
|
|
admin.site.register(Podcast, PodcastAdmin)
|
2009-04-18 23:03:29 +02:00
|
|
|
admin.site.register(Vodcast, VodcastAdmin)
|
2009-03-31 02:03:34 +02:00
|
|
|
admin.site.register(Parent, ParentAdmin)
|
2009-04-01 05:11:58 +02:00
|
|
|
admin.site.register(EmptyModel, EmptyModelAdmin)
|
2009-04-01 16:14:20 +02:00
|
|
|
admin.site.register(Fabric, FabricAdmin)
|
2009-04-18 22:29:55 +02:00
|
|
|
admin.site.register(Gallery, GalleryAdmin)
|
|
|
|
admin.site.register(Picture, PictureAdmin)
|
2009-05-07 13:56:10 +02:00
|
|
|
admin.site.register(Language, LanguageAdmin)
|
2009-05-07 14:52:43 +02:00
|
|
|
admin.site.register(Recommendation, RecommendationAdmin)
|
|
|
|
admin.site.register(Recommender)
|
2009-05-09 13:40:13 +02:00
|
|
|
admin.site.register(Collector, CollectorAdmin)
|
2009-07-03 05:05:17 +02:00
|
|
|
admin.site.register(Category, CategoryAdmin)
|
2009-12-22 19:29:00 +01:00
|
|
|
admin.site.register(Post, PostAdmin)
|
2009-12-18 11:08:05 +01:00
|
|
|
admin.site.register(Gadget, GadgetAdmin)
|
2010-02-26 14:17:43 +01:00
|
|
|
admin.site.register(Villain)
|
|
|
|
admin.site.register(SuperVillain)
|
|
|
|
admin.site.register(Plot)
|
|
|
|
admin.site.register(PlotDetails)
|
|
|
|
admin.site.register(CyclicOne)
|
|
|
|
admin.site.register(CyclicTwo)
|
2011-01-13 00:30:47 +01:00
|
|
|
admin.site.register(WorkHour, WorkHourAdmin)
|
2011-02-08 13:00:21 +01:00
|
|
|
admin.site.register(Reservation)
|
2011-02-19 12:48:42 +01:00
|
|
|
admin.site.register(FoodDelivery, FoodDeliveryAdmin)
|
2011-02-19 15:05:07 +01:00
|
|
|
admin.site.register(RowLevelChangePermissionModel, RowLevelChangePermissionModelAdmin)
|
2011-02-21 00:09:25 +01:00
|
|
|
admin.site.register(Paper, PaperAdmin)
|
|
|
|
admin.site.register(CoverLetter, CoverLetterAdmin)
|
2011-03-03 14:20:45 +01:00
|
|
|
admin.site.register(Story, StoryAdmin)
|
|
|
|
admin.site.register(OtherStory, OtherStoryAdmin)
|
2008-12-16 18:42:18 +01:00
|
|
|
|
|
|
|
# We intentionally register Promo and ChapterXtra1 but not Chapter nor ChapterXtra2.
|
|
|
|
# That way we cover all four cases:
|
|
|
|
# related ForeignKey object registered in admin
|
|
|
|
# related ForeignKey object not registered in admin
|
|
|
|
# related OneToOne object registered in admin
|
|
|
|
# related OneToOne object not registered in admin
|
|
|
|
# when deleting Book so as exercise all four troublesome (w.r.t escaping
|
|
|
|
# and calling force_unicode to avoid problems on Python 2.3) paths through
|
|
|
|
# contrib.admin.util's get_deleted_objects function.
|
|
|
|
admin.site.register(Book, inlines=[ChapterInline])
|
|
|
|
admin.site.register(Promo)
|
2010-11-21 20:29:15 +01:00
|
|
|
admin.site.register(ChapterXtra1, ChapterXtra1Admin)
|
2010-03-21 15:23:25 +01:00
|
|
|
admin.site.register(Pizza, PizzaAdmin)
|
|
|
|
admin.site.register(Topping)
|
2010-12-23 04:44:38 +01:00
|
|
|
admin.site.register(Album, AlbumAdmin)
|
2011-01-20 01:33:32 +01:00
|
|
|
admin.site.register(Question)
|
|
|
|
admin.site.register(Answer)
|
2011-04-22 14:02:25 +02:00
|
|
|
admin.site.register(PrePopulatedPost, PrePopulatedPostAdmin)
|