I've installed django-nested-inline but I have problems. Here's my code:
from django.contrib import admin
from nested_inline.admin import NestedStackedInline, NestedModelAdmin
from .models import Positive, Negative, Option, Question
class PositiveInline(NestedStackedInline):
model = Positive
class NegativeInline(NestedStackedInline):
model = Negative
class OptionInline(NestedStackedInline):
model = Option
inlines = [PositiveInline, NegativeInline,]
class QuestionAdmin(NestedModelAdmin):
fieldsets = [
(None, {'fields': ['question_title']}),
('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
]
inlines = [OptionInline,]
admin.site.register(Question, QuestionAdmin)
When I try to add a new Question, I have this error:
AttributeError at /admin/question/question/add/
'OptionInline' object has no attribute 'queryset'
Am I doing something wrong?
In case anyone is stuck waiting for this to come through to pip. In your admin, replace your use of NestedStackedInline with your own specialization e.g. MyNestedStackedInline thus:
Posted this as a comment, but since it worked out I'll post this here for future reference. Seems like this is the result of a bug, referenced and a fix has been applied here: https://github.com/s-block/django-nested-inline/issues/31