Replace counter-arguments with possible answers and unify search inputs.

Models, AI assistant, and UI now show diskussionsfertige Antworten without titles; shared search partial fixes aria-label rendering.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Pirmin Hinderling (fedora)
2026-07-07 22:50:53 +02:00
parent 28aab3b16a
commit 16428f2c16
19 changed files with 237 additions and 101 deletions
+9 -9
View File
@@ -53,8 +53,8 @@ class ReviewDraftForm(forms.ModelForm):
required=False,
widget=forms.Textarea(attrs={'class': 'form-control font-monospace', 'rows': 6}),
)
counter_arguments_json = forms.CharField(
label='Gegenargumente (JSON)',
possible_answers_json = forms.CharField(
label='Mögliche Antworten (JSON)',
required=False,
widget=forms.Textarea(attrs={'class': 'form-control font-monospace', 'rows': 6}),
)
@@ -95,8 +95,8 @@ class ReviewDraftForm(forms.ModelForm):
self.fields['sources_json'].initial = json.dumps(
instance.sources or [], ensure_ascii=False, indent=2
)
self.fields['counter_arguments_json'].initial = json.dumps(
instance.counter_arguments or [], ensure_ascii=False, indent=2
self.fields['possible_answers_json'].initial = json.dumps(
instance.possible_answers or [], ensure_ascii=False, indent=2
)
if instance.category_slug:
category = Category.objects.filter(slug=instance.category_slug).first()
@@ -119,23 +119,23 @@ class ReviewDraftForm(forms.ModelForm):
raise forms.ValidationError('Quellen müssen eine JSON-Liste sein.')
return data
def clean_counter_arguments_json(self):
raw = (self.cleaned_data.get('counter_arguments_json') or '').strip()
def clean_possible_answers_json(self):
raw = (self.cleaned_data.get('possible_answers_json') or '').strip()
if not raw:
return []
try:
data = json.loads(raw)
except json.JSONDecodeError as exc:
raise forms.ValidationError('Ungültiges JSON für Gegenargumente.') from exc
raise forms.ValidationError('Ungültiges JSON für mögliche Antworten.') from exc
if not isinstance(data, list):
raise forms.ValidationError('Gegenargumente müssen eine JSON-Liste sein.')
raise forms.ValidationError('Mögliche Antworten müssen eine JSON-Liste sein.')
return data
def save(self, commit=True):
draft = super().save(commit=False)
draft.tags = self.cleaned_data['tags_text']
draft.sources = self.cleaned_data['sources_json']
draft.counter_arguments = self.cleaned_data['counter_arguments_json']
draft.possible_answers = self.cleaned_data['possible_answers_json']
category = self.cleaned_data.get('category_choice')
if category:
draft.category_slug = category.slug