0

How do I have the AdminSite show a list of all related_set objects pointing to a specific object.

The code:

from django.db import models
from django.contrib.auth.models import User

class Contact(models.Model):
    user = models.ForeignKey(User)
    user_contact = models.ForeignKey(User)


from django.contrib import admin
class UserAdmin(admin.ModelAdmin):
    pass
class ContactAdmin(admin.ModelAdmin):
    pass

admin.site.register(User, UserAdmin)
admin.site.register(Contact, ContactAdmin)

I want the UserAdmin object view to show a list of all Contact objects that points to the specific User object.

4

1 回答 1

1

Use InlineModelAdmin objects.

于 2013-03-30T21:36:27.573 回答