Částečné řešení #1465 (Podezřelé seminar
e)
This commit is contained in:
parent
b8f377b15d
commit
5db14ea242
22 changed files with 45 additions and 42 deletions
|
@ -1,6 +1,6 @@
|
|||
from django.test import TestCase, tag
|
||||
from django.urls import reverse
|
||||
import seminar.models as m
|
||||
from personalni.models import Skola
|
||||
from personalni.utils import sync_skoly
|
||||
|
||||
@tag('stejny-model-na-produkci')
|
||||
|
@ -48,7 +48,7 @@ class OrgSkolyAutocompleteTestCase(TestCase):
|
|||
"""Testuje, že pro každého orga je jeho škola ve výsledném QuerySetu"""
|
||||
for pfx, id in self.spravna_data:
|
||||
with self.subTest(prefix=pfx, spravne_id=id):
|
||||
spravna_skola = m.Skola.objects.get(id=id)
|
||||
spravna_skola = Skola.objects.get(id=id)
|
||||
# Zeptáme se view, co si myslí
|
||||
resp = self.client.get(reverse('autocomplete_skola')+'?q='+pfx).json()
|
||||
ids = [int(x['id']) for x in resp['results']]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import seminar.models as m
|
||||
import personalni.models as m
|
||||
from django.core import serializers as ser
|
||||
from django.http import HttpResponse
|
||||
def exportSkolView(request):
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.template import RequestContext
|
|||
from datetime import datetime
|
||||
|
||||
from galerie.models import Obrazek, Galerie
|
||||
from seminar.models import Soustredeni
|
||||
from soustredeni.models import Soustredeni
|
||||
from galerie.forms import KomentarForm, NewGalerieForm
|
||||
|
||||
def zobrazit(galerie, request):
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{% if not novinka.zverejneno and user.je_org %}
|
||||
<div class="mam-org-only">
|
||||
<ul>
|
||||
<li><a href="/admin/seminar/novinky/{{novinka.pk}}">Upravit novinku</a>
|
||||
<li><a href="/admin/novinky/novinky/{{novinka.pk}}">Upravit novinku</a>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if novinka.zverejneno or user.je_org %}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.contrib import admin
|
||||
from django_reverse_admin import ReverseModelAdmin
|
||||
import seminar.models as m
|
||||
import odevzdavatko.models as m
|
||||
|
||||
|
||||
class PrilohaReseniInline(admin.TabularInline):
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.forms import formset_factory
|
|||
from django.forms.models import inlineformset_factory
|
||||
from django.utils import timezone
|
||||
|
||||
from seminar.models import Resitel
|
||||
from personalni.models import Resitel
|
||||
import seminar.models as m
|
||||
|
||||
import logging
|
||||
|
|
|
@ -2,11 +2,11 @@ from django import template
|
|||
register = template.Library()
|
||||
|
||||
from functools import cache
|
||||
import seminar.models as m
|
||||
from odevzdavatko.models import Reseni
|
||||
|
||||
@register.filter
|
||||
@cache
|
||||
def barva_reseni(r: m.Reseni):
|
||||
def barva_reseni(r: Reseni):
|
||||
"""Vrátí nějakou barvu pro daný problém, ve tvaru '#RRGGBB'
|
||||
|
||||
Efektivně hešujeme do barev."""
|
||||
|
|
|
@ -2,8 +2,8 @@ from django import template
|
|||
register = template.Library()
|
||||
|
||||
from personalni.utils import normalizuj_jmeno
|
||||
import seminar.models as m # jen kvůli typové anotaci…
|
||||
from personalni.models import Osoba # jen kvůli typové anotaci…
|
||||
|
||||
@register.filter
|
||||
def jmeno_jako_prefix(o: m.Osoba):
|
||||
def jmeno_jako_prefix(o: Osoba):
|
||||
return normalizuj_jmeno(o).replace(' ', '_')
|
||||
|
|
|
@ -2,7 +2,7 @@ from django.contrib import admin
|
|||
from django.contrib.auth.models import Group
|
||||
from django_reverse_admin import ReverseModelAdmin
|
||||
from django.contrib.messages import WARNING, ERROR, SUCCESS
|
||||
import seminar.models as m
|
||||
import personalni.models as m
|
||||
from datetime import datetime
|
||||
|
||||
@admin.action(description="Sjednoť telefony")
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.forms import PasswordResetForm
|
|||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from seminar.models import Skola, Resitel, Osoba
|
||||
from personalni.models import Skola, Resitel, Osoba
|
||||
|
||||
from datetime import date
|
||||
import logging
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.contrib.auth.models import User, Group
|
|||
from django.contrib.admin.sites import AdminSite
|
||||
from personalni.admin import OsobaAdmin
|
||||
# Tohle bude peklo, až jednou ty modely fakt rozstřelíme… Možná vyrobit various.all_models, které půjdou importovat jako m? :-)
|
||||
import seminar.models as m
|
||||
import personalni.models as m
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import seminar.models as m
|
||||
from various.utils import bez_diakritiky_translate
|
||||
import re
|
||||
|
||||
|
@ -7,9 +6,10 @@ from django.contrib.auth.decorators import permission_required, user_passes_test
|
|||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.db import transaction
|
||||
|
||||
import seminar.models as m
|
||||
import soustredeni.models
|
||||
|
||||
from odevzdavatko.models import Reseni_Resitele
|
||||
|
||||
from .models import Osoba, Organizator, Skola, Resitel, Prijemce
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ def merge_resitele(cilovy, zdrojovy):
|
|||
# Přepojit všechny vazby ze zdrojového na cílového
|
||||
print('Přepojuji vazby')
|
||||
# Vazby: Škola (hotovo), Řešení_Řešitelé, Konfery_Účastníci, Soustředění_Účastníci, Osoba (vyřeší se později, nejde přepojit)
|
||||
ct = m.Reseni_Resitele.objects.filter(resitele=zdrojovy).update(resitele=cilovy)
|
||||
ct = Reseni_Resitele.objects.filter(resitele=zdrojovy).update(resitele=cilovy)
|
||||
print(f' Přepojeno {ct} řešení')
|
||||
ct = soustredeni.models.Konfery_Ucastnici.objects.filter(resitel=zdrojovy).update(resitel=cilovy)
|
||||
print(f' Přepojeno {ct} konfer')
|
||||
|
|
|
@ -17,7 +17,9 @@ from django.http import HttpResponse
|
|||
from django.utils import timezone
|
||||
|
||||
import seminar.models as s
|
||||
import seminar.models as m
|
||||
import personalni.models as m
|
||||
from soustredeni.models import Soustredeni
|
||||
from odevzdavatko.models import Hodnoceni
|
||||
from .forms import PrihlaskaForm, ProfileEditForm, PoMaturiteProfileEditForm
|
||||
|
||||
from datetime import date
|
||||
|
@ -91,7 +93,7 @@ class OrgoRozcestnikView(TemplateView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['posledni_soustredeni'] = s.Soustredeni.objects.order_by('-datum_konce').first()
|
||||
context['posledni_soustredeni'] = Soustredeni.objects.order_by('-datum_konce').first()
|
||||
nastaveni = s.Nastaveni.objects.first()
|
||||
aktualni_rocnik = nastaveni.aktualni_rocnik
|
||||
context['posledni_cislo_url'] = nastaveni.aktualni_cislo.verejne_url()
|
||||
|
@ -99,14 +101,14 @@ class OrgoRozcestnikView(TemplateView):
|
|||
# pokud nechceme haluzit kód (= poradi) dalšího čísla, bude asi potřeba jít
|
||||
# přes treenody (a dát si přitom pozor na MezicisloNode)
|
||||
|
||||
neobodovana_reseni = s.Hodnoceni.objects.filter(body__isnull=True)
|
||||
reseni_mimo_cislo = s.Hodnoceni.objects.filter(deadline_body__isnull=True)
|
||||
neobodovana_reseni = Hodnoceni.objects.filter(body__isnull=True)
|
||||
reseni_mimo_cislo = Hodnoceni.objects.filter(deadline_body__isnull=True)
|
||||
context['pocet_neobodovanych_reseni'] = neobodovana_reseni.count()
|
||||
context['pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.count()
|
||||
|
||||
u = self.request.user
|
||||
os = s.Osoba.objects.get(user=u)
|
||||
organizator = s.Organizator.objects.get(osoba=os)
|
||||
os = m.Osoba.objects.get(user=u)
|
||||
organizator = m.Organizator.objects.get(osoba=os)
|
||||
|
||||
context['muj_pocet_neobodovanych_reseni'] = neobodovana_reseni.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).distinct().count()
|
||||
context['muj_pocet_reseni_mimo_cislo'] = reseni_mimo_cislo.filter(Q(problem__garant=organizator) | Q(problem__autor=organizator) | Q(problem__opravovatele__in=[organizator])).count()
|
||||
|
@ -134,12 +136,12 @@ class OrgoRozcestnikView(TemplateView):
|
|||
|
||||
|
||||
class ResitelView(LoginRequiredMixin,generic.DetailView):
|
||||
model = s.Resitel
|
||||
model = m.Resitel
|
||||
template_name = 'personalni/profil/resitel.html'
|
||||
|
||||
def get_object(self, queryset=None):
|
||||
print(self.request.user)
|
||||
return s.Resitel.objects.get(osoba__user=self.request.user)
|
||||
return m.Resitel.objects.get(osoba__user=self.request.user)
|
||||
|
||||
### Formulare
|
||||
|
||||
|
@ -160,7 +162,7 @@ def resitelEditView(request):
|
|||
err_logger = logging.getLogger('seminar.prihlaska.problem')
|
||||
## Načtení objektů Osoba a Resitel patřících k aktuálně přihlášenému uživateli
|
||||
u = request.user
|
||||
osoba_edit = s.Osoba.objects.get(user=u)
|
||||
osoba_edit = m.Osoba.objects.get(user=u)
|
||||
if hasattr(osoba_edit,'resitel'):
|
||||
resitel_edit = osoba_edit.resitel
|
||||
else:
|
||||
|
@ -266,7 +268,7 @@ def prihlaskaView(request):
|
|||
resitel_grp = Group.objects.filter(name__exact='resitel').first()
|
||||
u.groups.add(resitel_grp)
|
||||
|
||||
o = s.Osoba(
|
||||
o = m.Osoba(
|
||||
jmeno = fcd['jmeno'],
|
||||
prijmeni = fcd['prijmeni'],
|
||||
osloveni = fcd['osloveni'],
|
||||
|
@ -328,7 +330,7 @@ def prihlaskaView(request):
|
|||
if kolize.count() > 1: # Jednu z nich jsme právě uložili
|
||||
err_logger.warning(f'Zaregistrovala se osoba s kolizním jménem. ID osob: {[o.id for o in kolize]}')
|
||||
|
||||
r = s.Resitel(
|
||||
r = m.Resitel(
|
||||
prezdivka_resitele=fcd['prezdivka_resitele'] if fcd['prezdivka_resitele'] != "" else None,
|
||||
rok_maturity = fcd['rok_maturity'],
|
||||
zasilat = fcd['zasilat'],
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe
|
|||
from django.utils.html import escape
|
||||
|
||||
from .models import Prednaska, Seznam, STAV_NAVRH
|
||||
from seminar.models import Soustredeni
|
||||
from soustredeni.models import Soustredeni
|
||||
|
||||
|
||||
class Seznam_PrednaskaInline(admin.TabularInline):
|
||||
|
|
|
@ -6,7 +6,8 @@ from django.db.models import Sum
|
|||
from django.forms import Form
|
||||
|
||||
from prednasky.models import Prednaska, Hlasovani, Seznam, STAV_NAVRH
|
||||
from seminar.models import Soustredeni, Osoba
|
||||
from soustredeni.models import Soustredeni
|
||||
from personalni.models import Osoba
|
||||
|
||||
def newPrednaska(request):
|
||||
# hlasovani se vztahuje k nejnovejsimu soustredeni
|
||||
|
|
|
@ -25,20 +25,20 @@
|
|||
<button>Zvyš úroveň nadpisu</button> - nejsou testovací data
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include "seminar/treenode_name.html" %}
|
||||
{% include "treenode/treenode_name.html" %}
|
||||
{%if obj.children %}
|
||||
<div class="borderized children">
|
||||
|
||||
{% with kam="před" kam_slug="syn" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %}
|
||||
{% with kam="před" kam_slug="syn" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %}
|
||||
{%for ch in obj.children %}
|
||||
|
||||
{# ----------- Vypisujeme podstrom ----------#}
|
||||
{%with obj=ch depth=depth|add:"1" %} {%include "seminar/treenode_recursive.html" %} {%endwith%}
|
||||
{%with obj=ch depth=depth|add:"1" %} {%include "treenode/treenode_recursive.html" %} {%endwith%}
|
||||
{# ----------- Přidáváme mezi syny / za posledního -------- #}
|
||||
{% if forloop.last %}
|
||||
{% with kam="za" kam_slug="za" obj=ch %} {% include "seminar/treenode_add_stub.html" %} {% endwith %}
|
||||
{% with kam="za" kam_slug="za" obj=ch %} {% include "treenode/treenode_add_stub.html" %} {% endwith %}
|
||||
{% else %}
|
||||
{% with kam="mezi" obj=ch kam_slug="za" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %}
|
||||
{% with kam="mezi" obj=ch kam_slug="za" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %}
|
||||
{% endif %}
|
||||
{# ----------- Prohazujeme sousedy ----------#}
|
||||
<div class="pink">
|
||||
|
@ -50,6 +50,6 @@
|
|||
</div>
|
||||
{% else %}
|
||||
{# ----------- Přidáváme prvního syna ----------#}
|
||||
{% with kam="jako syna" kam_slug="syn" %} {% include "seminar/treenode_add_stub.html" %} {% endwith %}
|
||||
{% with kam="jako syna" kam_slug="syn" %} {% include "treenode/treenode_add_stub.html" %} {% endwith %}
|
||||
{%endif%}
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
{% extends "tvorba/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
{% if problem.cislo_zadani %}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
{% extends "tvorba/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
<h1>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
{% extends "tvorba/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
<h1>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "seminar/archiv/problem.html" %}
|
||||
{% extends "tvorba/archiv/problem.html" %}
|
||||
|
||||
{% block problem %}
|
||||
<h1>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends 'seminar/clanky/resitelske_clanky.html' %}
|
||||
{% extends 'tvorba/clanky/resitelske_clanky.html' %}
|
||||
|
||||
{% block nadpis1a %}
|
||||
Organizátorské články
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.views.generic import FormView, ListView
|
||||
|
||||
from seminar.models import Osoba
|
||||
from personalni.models import Osoba
|
||||
from various.views.pomocne import formularOKView
|
||||
from .forms import UcastnikVyrociForm
|
||||
from .models import UcastnikVyroci
|
||||
|
|
Loading…
Reference in a new issue