python - Nested Inline in Django Admin -
i have following scenario there 3 models follows should displayed nested in django admin. using django 1.6 release , applied settings put in https://github.com/soaa-/django-nested-inlines
however, didnt turn expected output. there other solutions implement nested inlines in django. i'm newbie framework. kindly guide me fix issue.
model.py
class project(models.model): name = models.charfield(max_length=200) code = models.integerfield(default=0) def __unicode__(self): return self.name class detail(models.model): project = models.foreignkey(project) value = models.decimalfield(max_digits=5, decimal_places=2) location = models.integerfield(default=0) class configuration(models.model): detail = models.onetoonefield(detail) content1 = models.integerfield() content2 = models.integerfield()
admin.py
from django.contrib import admin nested_inlines.admin import nestedmodeladmin, nestedtabularinline, nestedstackedinline myapp.models import project, detail, configuration class configinline(nestedstackedinline): model = configuration = 1 class detailinline(nestedtabularinline): model = detail inlines = [configinline,] = 1 class projectadmin(admin.modeladmin): inlines = [detailinline] admin.site.register(project, projectadmin)
try https://pypi.python.org/pypi/django-nested-inline .
it has been updated work django 1.6
Comments
Post a Comment