diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 104c2df3..777cc87b 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -395,8 +395,8 @@ input[type="file"] { border-width:1px; border-radius: 5px; padding:3px; - top:20px; - left:20px; + top:50px; + left:10px; } .field-with-comment:hover span.field-comment{ diff --git a/seminar/admin.py b/seminar/admin.py index 4ce6ded5..4da32e96 100644 --- a/seminar/admin.py +++ b/seminar/admin.py @@ -46,11 +46,11 @@ class OsobaAdmin(admin.ModelAdmin): @admin.register(m.Organizator) class OrganizatorAdmin(admin.ModelAdmin): - search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'prezdivka'] + search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka'] @admin.register(m.Resitel) class ResitelAdmin(admin.ModelAdmin): - search_fields = ['jmeno', 'prijmeni', 'prezdivka'] + search_fields = ['osoba__jmeno', 'osoba__prijmeni', 'osoba__prezdivka'] ordering = ('osoba__jmeno','osoba__prijmeni') @admin.register(m.Problem) @@ -65,29 +65,28 @@ class ProblemAdmin(PolymorphicParentModelAdmin): # Pokud chceme orezavat na aktualni rocnik, musime do modelu pridat odkaz na rocnik. Zatim bere vse. search_fields = ['nazev'] +# V ProblemAdmin to nejde, protoze se to nepropise do deti +class ProblemAdminMixin(object): + show_in_index = True + autocomplete_fields = ['nadproblem','autor','garant'] + filter_horizontal = ['opravovatele'] + + @admin.register(m.Tema) -class TemaAdmin(PolymorphicChildModelAdmin): +class TemaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin): base_model = m.Tema - show_in_index = True - autocomplete_fields = ['nadproblem'] @admin.register(m.Clanek) -class ClanekAdmin(PolymorphicChildModelAdmin): +class ClanekAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin): base_model = m.Clanek - show_in_index = True - autocomplete_fields = ['nadproblem'] @admin.register(m.Uloha) -class UlohaAdmin(PolymorphicChildModelAdmin): +class UlohaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin): base_model = m.Uloha - show_in_index = True - autocomplete_fields = ['nadproblem'] @admin.register(m.Konfera) -class KonferaAdmin(PolymorphicChildModelAdmin): +class KonferaAdmin(ProblemAdminMixin,PolymorphicChildModelAdmin): base_model = m.Konfera - show_in_index = True - autocomplete_fields = ['nadproblem'] class TextAdminInline(admin.TabularInline): diff --git a/seminar/forms.py b/seminar/forms.py index fd380026..c64095c6 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -2,6 +2,7 @@ from django import forms from dal import autocomplete from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.models import User +from django.forms import formset_factory from django.forms.models import inlineformset_factory from .models import Skola, Resitel, Osoba, Problem @@ -301,3 +302,17 @@ class NahrajObrazekKTreeNoduForm(forms.ModelForm): model = m.Obrazek fields = ('na_web',) + +class JednoHodnoceniForm(forms.ModelForm): + class Meta: + model = m.Hodnoceni + fields = ('problem', 'body', 'cislo_body') + widgets = { + 'problem': autocomplete.ModelSelect2( + url='autocomplete_problem_odevzdatelny', # FIXME: Dovolit i starší? + ) + } + +OhodnoceniReseniFormSet = formset_factory(JednoHodnoceniForm, + extra = 0, + ) diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index fc04b439..a875caba 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -84,7 +84,7 @@
Řešené problémy: {{ object.problem.all | join:", " }}
Řešitelé: {{ object.resitele.all | join:", " }}
@@ -27,21 +80,33 @@ {% endif %} {# Hodnocení: #} -{# FIXME: Udělat jako formulář #}