On Wed, Jan 21, 2009 at 11:36 AM, Benjamin Buch <[email protected]> wrote:
> I simplified the models a bit for better demonstration.
>
Thanks. That makes it easier to spot the problem.
> Here's the model:
>
> from django.db import models
>
> class a(models.Model):
> title = models.CharField(max_length=50)
> other_model = models.ManyToManyField('b')
>
> def __unicode__(self):
> return self.title
>
> class b(models.Model):
> title = models.CharField(max_length=50)
>
> def __unicode__(self):
> return self.title
>
> Here's admin.py:
>
> from myproject.myapp.models import a, b
> from django.contrib import admin
>
> class bInline(admin.TabularInline):
> model = b
>
> class aAdmin(admin.ModelAdmin):
> inlines = [bInline]
>
> admin.site.register(b, bInline)
>
This is the problem. You don't need to register inlines. You register the
model ModelAdmin that includes them in 'inlines', namely:
> admin.site.register(a, aAdmin)
>
is all you need to register. If you want an admin page for model b
independent of the inlines edited with model a, then you need to create a
regular ModelAdmin for b and register that.
Karen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---