Created
September 24, 2012 17:27
-
-
Save jpatel3/3777157 to your computer and use it in GitHub Desktop.
django admin.py for content managment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from units.models import Unit | |
from references_u.models import ReferenceU | |
from qna.models import Question, QuestionHints, QuestionAnswer, QuestionAnswerChoice | |
class ReferenceUInline(admin.StackedInline): | |
model = ReferenceU | |
extra = 1 | |
class QuestionHintsInline(admin.StackedInline): | |
model = QuestionHints | |
extra = 2 | |
class QuestionAnswerInline(admin.StackedInline): | |
model = QuestionAnswer | |
extra = 1 | |
class QuestionAnswerChoiceInline(admin.StackedInline): | |
model = QuestionAnswerChoice | |
extra = 1 | |
class QuestionInline(admin.StackedInline): | |
#change_form_template = ['admin/qna/change_form.html'] | |
model = Question | |
inlines = [QuestionHintsInline, QuestionAnswerInline, QuestionAnswerChoiceInline] | |
extra = 3 | |
class UnitsAdmin(admin.ModelAdmin): | |
change_form_template = ['admin/units/change_form.html'] | |
date_heiarchy = 'created' | |
inlines = [ReferenceUInline, QuestionInline] | |
admin.site.register(Unit, UnitsAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment