I'm doing something wrong when I try to register models for the admin
interface and I'm not sure what it is. I have everything in my
installed apps, is there something wrong with these files?
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
'django.contrib.admindocs',
'testproject.search',
'blog',
)
search/models.py
from django.db import models
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
class SearchKeyword(models.Model):
keyword = models.CharField(max_length=50)
page = models.ForeignKey(FlatPage)
def __unicode__(self):
return self.keyword
search/admin.py
from testproject.search.models import SearchKeyword
from django.contrib.flatpages.models import FlatPage
from django.contrib import admin
from django.contrib.contenttypes import generic
class KeywordInline(generic.GenericStackedInline):
model = SearchKeyword
class PageAdmin(admin.ModelAdmin):
inlines = [
KeywordInline,
]
admin.site.register(PageAdmin)
blog/models.py
from django.db import models
class Category(models.Model):
title = models.CharField(max_length=250)
slug = models.SlugField(unique=True)
description = models.TextField()
def __unicode__(self):
return self.title
blog/admin.py
from django.contrib import admin
from blog.models import Category
admin.site.register(Category)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=.