I'm trying to use nested_inlines and read that the bug, that the third inline is not shown was already fixed. But still I have the same problems. I'm using django 1.6.5 and python 2.7.5. The nested_inlines I downloaded from https://pypi.python.org/pypi/django-nested-inlines .
I tried the examples in the internet and put 'nested_inlines' into the INSTALLED_APPS, but I don't see the third line in my admin site.
Here my code in models.py:
from django.db import models
class A(models.Model):
name = models.CharField(max_length = 200)
class B(models.Model):
name = models.CharField(max_length = 200)
fk_a = models.ForeignKey('A')
class C(models.Model):
name = models.CharField(max_length = 200)
fk_b = models.ForeignKey('B')
admin.py:
from django.contrib import admin
from .models import A,B,C
from nested_inlines.admin import NestedStackedInline, NestedModelAdmin
class cInline (NestedStackedInline):
model = C
class bInline(NestedStackedInline):
model = B
inlines = [cInline,]
extra = 1
class aAdmin(NestedModelAdmin):
inlines =[bInline,]
admin.site.register(A, aAdmin)
What did I forgot? Any advices?
I believe it is a bug. Im working on the exact same problem right now. Try adding an
extra
tocInline
:It just doesn't seem to show up when there are no related models.
edit: also, use this repo instead: https://github.com/silverfix/django-nested-inlines
They recommend it here (at the bottom): https://code.djangoproject.com/ticket/9025
installation:
pip install -e git+git://github.com/silverfix/django-nested-inlines.git#egg=django-nested-inlines