hotfix: org nemůže přiřadit hodnocení nezadaný problém (např. vyřešený)
This commit is contained in:
parent
d15a8f3880
commit
7b5db01377
3 changed files with 11 additions and 1 deletions
|
@ -23,6 +23,7 @@ urlpatterns = [
|
|||
path('api/autocomplete/skola/', views.SkolaAutocomplete.as_view(), name='autocomplete_skola'),
|
||||
path('api/autocomplete/resitel/', org_required(views.ResitelAutocomplete.as_view()), name='autocomplete_resitel'),
|
||||
path('api/autocomplete/problem/odevzdatelny', views.OdevzdatelnyProblemAutocomplete.as_view(), name='autocomplete_problem_odevzdatelny'),
|
||||
path('api/autocomplete/problem/vsechny', views.ProblemAutocomplete.as_view(), name='autocomplete_problem'),
|
||||
|
||||
# Ceka na autocomplete v3
|
||||
# path('autocomplete/organizatori/',
|
||||
|
|
|
@ -66,6 +66,15 @@ class OdevzdatelnyProblemAutocomplete(autocomplete.Select2QuerySetView):
|
|||
Q(nazev__icontains=self.q))
|
||||
return qs
|
||||
|
||||
class ProblemAutocomplete(autocomplete.Select2QuerySetView):
|
||||
""" View k :mod:`dal.autocomplete` pro vyhledávání problémů především v odevzdávátku. """
|
||||
def get_queryset(self):
|
||||
qs = m.Problem.objects.all().order_by("-stav", "nazev")
|
||||
if self.q:
|
||||
qs = qs.filter(
|
||||
Q(nazev__icontains=self.q))
|
||||
return qs
|
||||
|
||||
# Ceka na autocomplete v3
|
||||
# class OrganizatorAutocomplete(autocomplete.Select2QuerySetView):
|
||||
# def get_queryset(self):
|
||||
|
|
|
@ -91,7 +91,7 @@ class JednoHodnoceniForm(forms.ModelForm):
|
|||
fields = ('problem', 'body', 'deadline_body', 'feedback',)
|
||||
widgets = {
|
||||
'problem': autocomplete.ModelSelect2(
|
||||
url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší?
|
||||
url='autocomplete_problem',
|
||||
),
|
||||
'feedback': forms.Textarea(attrs={'rows': 1, 'cols': 30, 'class': 'feedback'}),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue