From 2074f2d64876623ed4c8339e5eb71b30ef9db9a6 Mon Sep 17 00:00:00 2001 From: Irae Hueck Costa Date: Tue, 12 May 2026 12:40:05 +0200 Subject: [PATCH] Claude code output --- polls/admin.py | 2 +- polls/forms.py | 6 ++++-- polls/models.py | 1 + polls/templates/polls/poll_detail.html | 3 +++ 4 files changed, 9 insertions(+), 3 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..dfff35d074 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..71af947df4 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) 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/poll_detail.html b/polls/templates/polls/poll_detail.html index f76a918c99..73403a88ba 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 %}