Skip to content
Snippets Groups Projects
Commit 4ac40723 authored by Julian's avatar Julian
Browse files

Add action-buttons to Admin

parent d458ad03
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -2,6 +2,14 @@ from django.contrib import admin
from faq.models import Question, FAQQuestion
# Register your models here.
def show(modeladmin, request, queryset):
queryset.update(show=True)
show.short_description = "Ausgewählte Fragen veröffentlichen"
def hide(modeladmin, request, queryset):
queryset.update(show=False)
hide.short_description = "Ausgewählte Fragen nicht mehr veröffentlichen"
class QuestionAdmin(admin.ModelAdmin):
list_display = ("question_text", "pub_date", "user", "answered")
list_filter = ("answered",)
......@@ -10,5 +18,6 @@ admin.site.register(Question, QuestionAdmin)
class FAQQuestionAdmin(admin.ModelAdmin):
list_display = ("question_text", "icon", "show")
actions = [show, hide]
admin.site.register(FAQQuestion, FAQQuestionAdmin)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment