admin tests
This commit is contained in:
1 parent
b5fef273ee
commit
c58c9b2cae
2 files changed
+7
-29
No files matched your search
@@ -73,7 +73,7 @@ INSTALLED_APPS = [
|
|||||||
'commeteresp',
|
'commeteresp',
|
||||||
'safety',
|
'safety',
|
||||||
'vote.apps.VoteConfig',
|
'vote.apps.VoteConfig',
|
||||||
|
'nested_admin',
|
||||||
# 'orgmanagment',
|
# 'orgmanagment',
|
||||||
'corsheaders',
|
'corsheaders',
|
||||||
'watcher.apps.WatcherConfig',
|
'watcher.apps.WatcherConfig',
|
||||||
|
|||||||
+6
-28
@@ -1,39 +1,17 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import Test, TestAnswer, TestQuestion
|
from .models import Test, TestAnswer, TestQuestion
|
||||||
|
import nested_admin
|
||||||
|
|
||||||
|
class TestAnswerInline(nested_admin.NestedStackedInline):
|
||||||
class TestAnswerInline(admin.StackedInline):
|
|
||||||
"""
|
|
||||||
Инлайн ответов
|
|
||||||
"""
|
|
||||||
|
|
||||||
model = TestAnswer
|
model = TestAnswer
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
class TestQuestionInline(nested_admin.NestedStackedInline):
|
||||||
class TestQuestionAdmin(admin.ModelAdmin):
|
|
||||||
"""
|
|
||||||
Админка вопросов к тесту
|
|
||||||
"""
|
|
||||||
|
|
||||||
inlines = [TestAnswerInline]
|
|
||||||
|
|
||||||
|
|
||||||
class TestQuestionInline(admin.StackedInline):
|
|
||||||
"""
|
|
||||||
Инлайн вопросов
|
|
||||||
"""
|
|
||||||
|
|
||||||
model = TestQuestion
|
model = TestQuestion
|
||||||
extra = 0
|
extra = 0
|
||||||
|
inlines = [TestAnswerInline]
|
||||||
|
|
||||||
|
class TestAdmin(nested_admin.NestedModelAdmin):
|
||||||
class TestAdmin(admin.ModelAdmin):
|
|
||||||
"Админка тестов"
|
|
||||||
|
|
||||||
inlines = [TestQuestionInline]
|
inlines = [TestQuestionInline]
|
||||||
|
|
||||||
|
admin.site.register(Test, TestAdmin)
|
||||||
admin.site.register(Test, TestAdmin)
|
|
||||||
admin.site.register(TestQuestion, TestQuestionAdmin)
|
|
||||||
admin.site.register(TestAnswer)
|
|
||||||
Reference in new issue
Block a user