On Thu, Feb 21, 2008 at 3:55 AM, Almir Karic <[EMAIL PROTECTED]> wrote:

>
> from django.db import models
> from django.contrib import admin
>
>
> # Create your models here.
>
> class Category(models.Model):
>        name = models.CharField(max_length=50)
>
>        def __str__(self):
>                return self.name
>
> class Forum(models.Model):
>        cat = models.ForeignKey(Category)
>        name = models.CharField(max_length=50)
>
>        def __str__(self):
>                return self.name
>
> class Category_admin(admin.ModelAdmin):
>        model = Category
>        inlines = [Forum]
>
>
You don't list your Model classes directly in inlines, but rather create a
class based off of admin.StackedInline or admin.TabularInline (which is
where you specify the actual Model), and list that class in inlines.

See:
http://code.djangoproject.com/wiki/NewformsHOWTO#Q:HowdoIsetupedit_inlineand
the last part of:
http://code.djangoproject.com/wiki/NewformsAdminBranch for examples.

Karen



> admin.site.register(Category, Category_admin)
>


> this is my models.py, when i try to access the admin interface for my
> Category object i get an ugly error google knows nothing about :(
>
> Environment:
>
> Request Method: GET
> Request URL: http://chat.kiberpipa.org:5222/admin/forum/category/2/
> Django Version: 0.97-newforms-admin-SVN-7135
> Python Version: 2.4.4
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'mysite.forum',
>  'mysite.todo',
>  'django_evolution']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.middleware.doc.XViewMiddleware')
>
>
> Traceback:
> File "/home/redduck666/django/newforms-admin/django/core/handlers/base.py"
> in get_response
>  82.                 response = callback(request, *callback_args,
> **callback_kwargs)
> File
> "/home/redduck666/django/newforms-admin/django/contrib/admin/sites.py"
> in root
>  137.                 return self.model_page(request, *url.split('/', 2))
> File
> "/home/redduck666/django/newforms-admin/django/contrib/admin/sites.py"
> in model_page
>  154.         return admin_obj(request, rest_of_url)
> File
> "/home/redduck666/django/newforms-admin/django/contrib/admin/options.py"
> in __call__
>  258.             return self.change_view(request, unquote(url))
> File
> "/home/redduck666/django/newforms-admin/django/contrib/admin/options.py"
> in change_view
>  568.             for FormSet in self.formsets_change(request, obj):
> File
> "/home/redduck666/django/newforms-admin/django/contrib/admin/options.py"
> in formsets_change
>  715.             yield inline.formset_change(request, obj)
>
> Exception Type: AttributeError at /admin/forum/category/2/
> Exception Value: 'Forum' object has no attribute 'formset_change'
>
>
> any hints?
>
> --
> error: one bad user found in front of screen
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to