mirror of
https://github.com/Sosokker/ku-polls.git
synced 2025-12-20 14:04:05 +01:00
1. Refine UI/UX Apply Tailwinds Rewrite all page 2. Add new feature to model Add new field - description - long - short - use default + editable instead of auto_add_now - track up vote - Change timezone - Add time left track -Add participant -Add up/down vote attribute -- Choice - Add total_vote -Add calculate_percentage of vote 3. Refine View -Redirect instead of home page -Add context to result, detail view -Apply ChartJS -Delete home
25 lines
708 B
Python
25 lines
708 B
Python
from django.contrib import admin
|
|
|
|
from .models import Choice, Question
|
|
|
|
|
|
class ChoiceInline(admin.TabularInline):
|
|
model = Choice
|
|
extra = 3
|
|
|
|
|
|
class QuestionAdmin(admin.ModelAdmin):
|
|
fieldsets = [
|
|
(None, {"fields": ["question_text"]}),
|
|
("End date", {"fields": ["end_date"], "classes": ["collapse"]}),
|
|
("Vote count", {"fields": ["up_vote_count", "down_vote_count"]}),
|
|
("Participant count", {"fields": ["participant_count"]}),
|
|
]
|
|
list_display = ["question_text", "pub_date", "end_date", "was_published_recently"]
|
|
inlines = [ChoiceInline]
|
|
list_filter = ["pub_date"]
|
|
search_fields = ["question_text"]
|
|
|
|
|
|
admin.site.register(Question, QuestionAdmin)
|
|
|