Reputation: 7183
I have a self referencing model like this:
class Item(models.model):
parent = models.ForeignKey('Item',null=True,blank=True)
field = models.CharField(max_length=100)
And I want to display the hierarchy in the admin, to do so I do:
class ItemInline(admin.TabularInline):
model = Item
can_delete = False
class ItemAdmin(admin.ModelAdmin):
inlines = (ItemInline,)
admin.site.register(Item, ItemAdmin)
However it does not work , when I try to acces an item in the admin it hangs endlessly but it I can access the list of items just fine. However when I remove the inline it works fine.
Upvotes: 2
Views: 3878
Reputation: 7183
Ok the issue i was facing was due to the fact I tried to display the whole object , by restricting the fields displayed it worked. I did it like this : Django - Excluding some fields in Inline Admin Interface
Upvotes: 2