oprava „Vložit řešení: více řešitelů“ a více řešení
This commit is contained in:
parent
831ed6c64c
commit
c93fa6c574
2 changed files with 15 additions and 5 deletions
|
@ -21,13 +21,23 @@ class DateInput(forms.DateInput):
|
||||||
|
|
||||||
|
|
||||||
class PosliReseniForm(forms.Form):
|
class PosliReseniForm(forms.Form):
|
||||||
#FIXME jen podproblémy daného problému
|
problem = forms.ModelMultipleChoiceField(
|
||||||
problem = forms.ModelChoiceField(label='Problém',queryset=m.Problem.objects.all())
|
queryset=m.Problem.objects.all(),
|
||||||
|
label="Problémy",
|
||||||
|
widget=autocomplete.ModelSelect2Multiple(
|
||||||
|
url='autocomplete_problem_odevzdatelny',
|
||||||
|
attrs={
|
||||||
|
'data-placeholder--id': '-1',
|
||||||
|
'data-placeholder--text': '---',
|
||||||
|
'data-allow-clear': 'true'
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
# to_field_name
|
# to_field_name
|
||||||
#problem = models.ManyToManyField(Problem, verbose_name='problém', help_text='Problém',
|
#problem = models.ManyToManyField(Problem, verbose_name='problém', help_text='Problém',
|
||||||
# through='Hodnoceni')
|
# through='Hodnoceni')
|
||||||
|
|
||||||
resitel = forms.ModelChoiceField(label="Řešitel",
|
resitel = forms.ModelMultipleChoiceField(label="Řešitelé",
|
||||||
queryset=Resitel.objects.all(),
|
queryset=Resitel.objects.all(),
|
||||||
widget=autocomplete.ModelSelect2Multiple(
|
widget=autocomplete.ModelSelect2Multiple(
|
||||||
url='autocomplete_resitel',
|
url='autocomplete_resitel',
|
||||||
|
|
|
@ -360,8 +360,8 @@ class PosliReseniView(LoginRequiredMixin, FormView):
|
||||||
forma=data['forma'],
|
forma=data['forma'],
|
||||||
poznamka=data['poznamka'],
|
poznamka=data['poznamka'],
|
||||||
)
|
)
|
||||||
nove_reseni.resitele.add(data['resitel'])
|
nove_reseni.resitele.add(*data['resitel'])
|
||||||
nove_reseni.problem.add(data['problem'])
|
nove_reseni.problem.add(*data['problem'])
|
||||||
nove_reseni.save()
|
nove_reseni.save()
|
||||||
|
|
||||||
context = self.get_context_data()
|
context = self.get_context_data()
|
||||||
|
|
Loading…
Reference in a new issue