From 8a51b9867b8276e78d0e4ee9ea09586164cc2f0d Mon Sep 17 00:00:00 2001 From: Irae Hueck Costa Date: Tue, 12 May 2026 12:50:07 +0200 Subject: [PATCH] Claudia output --- polls/admin.py | 2 +- polls/forms.py | 6 ++++-- polls/models.py | 1 + polls/templates/polls/add_poll.html | 2 +- polls/templates/polls/endpoll.html | 5 ++++- polls/templates/polls/poll_detail.html | 5 ++++- polls/templates/polls/poll_edit.html | 2 +- polls/templates/polls/poll_result.html | 5 ++++- polls/templates/polls/polls_list.html | 8 ++++++-- seeder.py | 1 + 10 files changed, 27 insertions(+), 10 deletions(-) diff --git a/polls/admin.py b/polls/admin.py index 543e5a95db..5536852cba 100644 --- a/polls/admin.py +++ b/polls/admin.py @@ -9,7 +9,7 @@ class ChoiceInline(admin.TabularInline): # or admin.StackedInline for a differe @admin.register(Poll) class PollAdmin(admin.ModelAdmin): list_display = ["text", "owner", "pub_date", "active", "created_at"] - search_fields = ["text", "owner__username"] + search_fields = ["text", "description", "owner__username"] list_filter = ["active", 'created_at', 'pub_date'] date_hierarchy = "pub_date" inlines = [ChoiceInline] diff --git a/polls/forms.py b/polls/forms.py index 935ae133f3..b496bc3bd0 100644 --- a/polls/forms.py +++ b/polls/forms.py @@ -11,18 +11,20 @@ class PollAddForm(forms.ModelForm): class Meta: model = Poll - fields = ['text', 'choice1', 'choice2'] + fields = ['text', 'description', 'choice1', 'choice2'] widgets = { 'text': forms.Textarea(attrs={'class': 'form-control', 'rows': 5, 'cols': 20}), + 'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3, 'cols': 20}), } class EditPollForm(forms.ModelForm): class Meta: model = Poll - fields = ['text', ] + fields = ['text', 'description'] widgets = { 'text': forms.Textarea(attrs={'class': 'form-control', 'rows': 5, 'cols': 20}), + 'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 3, 'cols': 20}), } diff --git a/polls/models.py b/polls/models.py index 0a21e98292..ba4690b924 100644 --- a/polls/models.py +++ b/polls/models.py @@ -7,6 +7,7 @@ class Poll(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE) text = models.TextField() + description = models.TextField(blank=True, default='') pub_date = models.DateTimeField(default=timezone.now) active = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now_add=True) diff --git a/polls/templates/polls/add_poll.html b/polls/templates/polls/add_poll.html index e07416f118..e1c9d2aabb 100644 --- a/polls/templates/polls/add_poll.html +++ b/polls/templates/polls/add_poll.html @@ -27,4 +27,4 @@

Create new poll

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/polls/templates/polls/endpoll.html b/polls/templates/polls/endpoll.html index a94b30f7cd..1a3664fc19 100644 --- a/polls/templates/polls/endpoll.html +++ b/polls/templates/polls/endpoll.html @@ -17,6 +17,9 @@

Result for: {{ poll.text }}

+ {% if poll.description %} +

{{ poll.description }}

+ {% endif %}
@@ -40,4 +43,4 @@

Result for: {{ poll.text }}

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/polls/templates/polls/poll_detail.html b/polls/templates/polls/poll_detail.html index f76a918c99..68bb08e493 100644 --- a/polls/templates/polls/poll_detail.html +++ b/polls/templates/polls/poll_detail.html @@ -17,6 +17,9 @@

Polls details page

{% endif %}

{{ poll }}

+ {% if poll.description %} +

{{ poll.description }}

+ {% endif %}
{% csrf_token %} {% for choice in poll.choice_set.all %} @@ -30,4 +33,4 @@

{{ poll }}

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/polls/templates/polls/poll_edit.html b/polls/templates/polls/poll_edit.html index dcff438ddd..89319fd22c 100644 --- a/polls/templates/polls/poll_edit.html +++ b/polls/templates/polls/poll_edit.html @@ -46,4 +46,4 @@

Choices

-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/polls/templates/polls/poll_result.html b/polls/templates/polls/poll_result.html index c42ab6ec1c..f4fe1b8add 100644 --- a/polls/templates/polls/poll_result.html +++ b/polls/templates/polls/poll_result.html @@ -20,6 +20,9 @@

Result for: {{ poll.text }}

{% else %}

"{{ poll.text }}" Has Ended Polling!

{% endif %} + {% if poll.description %} +

{{ poll.description }}

+ {% endif %}

Total: {{ poll.get_vote_count }} votes

@@ -45,4 +48,4 @@

Total: {{ poll.get_vote_count }} votes

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/polls/templates/polls/polls_list.html b/polls/templates/polls/polls_list.html index a9a2f625ec..4a4ef389a4 100644 --- a/polls/templates/polls/polls_list.html +++ b/polls/templates/polls/polls_list.html @@ -37,11 +37,15 @@

Welcome to polls List!