WIP: Vyčištění náhodných věcí (co mě tak kde štvalo) #59

Closed
zelvuska wants to merge 3 commits from vycisteni into master
  1. 1
      api/tests/test_skola_autocomplete.py
  2. 1
      galerie/admin.py
  3. 2
      galerie/forms.py
  4. 6
      galerie/views.py
  5. 2
      header_fotky/context_processors.py
  6. 3
      korektury/views.py
  7. 4
      mamweb/settings_local.py
  8. 6
      mamweb/settings_prod.py
  9. 4
      mamweb/settings_test.py
  10. 3
      mamweb/urls.py
  11. 3
      odevzdavatko/views.py
  12. 2
      personalni/tests.py
  13. 2
      personalni/views.py
  14. 1
      prednasky/views.py
  15. 2
      seminar/admin.py
  16. 1
      seminar/management/commands/load_org_permissions.py
  17. 3
      seminar/management/commands/save_org_permissions.py
  18. 4
      seminar/management/commands/testdata.py
  19. 4
      seminar/models/pomocne.py
  20. 4
      seminar/models/treenode.py
  21. 4
      seminar/models/tvorba.py
  22. 3
      seminar/templatetags/utils.py
  23. 2
      seminar/testutils.py
  24. 2
      seminar/urls.py
  25. 4
      seminar/utils.py
  26. 11
      seminar/views/views_all.py
  27. 1
      soustredeni/views.py
  28. 2
      treenode/admin.py
  29. 5
      treenode/views.py
  30. 6
      treenode/viewsets.py
  31. 1
      various/admin.py

1
api/tests/test_skola_autocomplete.py

@ -1,7 +1,6 @@
from django.test import TestCase, tag from django.test import TestCase, tag
from django.urls import reverse from django.urls import reverse
import seminar.models as m import seminar.models as m
import seminar.views as v
from seminar.utils import sync_skoly from seminar.utils import sync_skoly
@tag('stejny-model-na-produkci') @tag('stejny-model-na-produkci')

1
galerie/admin.py

@ -1,6 +1,5 @@
from galerie.models import Obrazek, Galerie from galerie.models import Obrazek, Galerie
from django.contrib import admin from django.contrib import admin
from django.http import HttpResponseRedirect
from django import forms from django import forms
from django.db import models from django.db import models

2
galerie/forms.py

@ -1,5 +1,5 @@
from django import forms from django import forms
from seminar.models import Soustredeni
class KomentarForm(forms.Form): class KomentarForm(forms.Form):
komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False) komentar = forms.CharField(label = "Komentář:", max_length = 300, required=False)

6
galerie/views.py

@ -1,9 +1,5 @@
import random from django.http import Http404
from django.http import HttpResponse, Http404
from django.shortcuts import render, HttpResponseRedirect, get_object_or_404 from django.shortcuts import render, HttpResponseRedirect, get_object_or_404
from django.template import RequestContext
from datetime import datetime
from galerie.models import Obrazek, Galerie from galerie.models import Obrazek, Galerie
from seminar.models import Soustredeni from seminar.models import Soustredeni

2
header_fotky/context_processors.py

@ -3,7 +3,7 @@ Context processory lze přidat do djanga v :mod:`~mamweb.settings` a dělají to
že do contextu (tj. to, z čeho se např. berou proměnné v templatech) libovolné že do contextu (tj. to, z čeho se např. berou proměnné v templatech) libovolné
stránky přidají další věci. stránky přidají další věci.
""" """
from datetime import datetime, date from datetime import datetime
import random import random
from django.conf import settings from django.conf import settings

3
korektury/views.py

@ -8,9 +8,6 @@ from django.db.models import Count,Q
from .models import Oprava,Komentar,KorekturovanePDF, Organizator from .models import Oprava,Komentar,KorekturovanePDF, Organizator
from .forms import OpravaForm from .forms import OpravaForm
import subprocess
import shutil
import os
class KorekturyListView(generic.ListView): class KorekturyListView(generic.ListView):
model = KorekturovanePDF model = KorekturovanePDF

4
mamweb/settings_local.py

@ -1,5 +1,3 @@
import os.path
# #
# Lokalni / vyvojove nastaveni settings.py # Lokalni / vyvojove nastaveni settings.py
# #
@ -10,6 +8,8 @@ import os.path
# Import common settings # Import common settings
from .settings_common import * from .settings_common import *
import os.path
MIDDLEWARE += ( MIDDLEWARE += (
'debug_toolbar.middleware.DebugToolbarMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware',
) )

6
mamweb/settings_prod.py

@ -1,5 +1,3 @@
import os.path
# #
# Produkcni nastaveni settings.py # Produkcni nastaveni settings.py
# #
@ -10,6 +8,8 @@ import os.path
# Import common settings # Import common settings
from .settings_common import * from .settings_common import *
import os
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
@ -45,8 +45,6 @@ DATABASES = {
}, },
} }
import os
SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz' SERVER_EMAIL = 'mamweb-prod-errors@mam.mff.cuni.cz'
ADMINS = [('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz')] ADMINS = [('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz')]

4
mamweb/settings_test.py

@ -1,5 +1,3 @@
import os.path
# #
# Testovaci nastaveni settings.py (testovani na atreyi) # Testovaci nastaveni settings.py (testovani na atreyi)
# #
@ -49,8 +47,6 @@ DATABASES = {
}, },
} }
import os
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz' SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
ADMINS = [ ADMINS = [
('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'), ('M&M ERRORs', 'mam-errors@mam.mff.cuni.cz'),

3
mamweb/urls.py

@ -7,9 +7,8 @@ from django.contrib import admin
from django.conf import settings from django.conf import settings
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django import views from django import views
from django.urls import path # As per docs.
from treenode.routers import router # from treenode.routers import router
urlpatterns = [ urlpatterns = [

3
odevzdavatko/views.py

@ -1,5 +1,4 @@
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.views.generic import ListView, DetailView, FormView
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.mail import EmailMessage from django.core.mail import EmailMessage
from django.utils import timezone from django.utils import timezone
@ -11,8 +10,6 @@ from django.urls import reverse
from django.db import transaction from django.db import transaction
from django.db.models import Q from django.db.models import Q
from dataclasses import dataclass
import datetime
from decimal import Decimal from decimal import Decimal
from itertools import groupby from itertools import groupby
import logging import logging

2
personalni/tests.py

@ -6,8 +6,6 @@ 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? :-) # 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 seminar.models as m
import logging
logger = logging.getLogger(__name__)
class DelaniOrguTest(TestCase): class DelaniOrguTest(TestCase):
def setUp(self): def setUp(self):

2
personalni/views.py

@ -1,7 +1,7 @@
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse from django.urls import reverse
from django.views import generic from django.views import generic
from django.db.models import Q, Count, Min from django.db.models import Q, Min
from django.views.decorators.debug import sensitive_post_parameters from django.views.decorators.debug import sensitive_post_parameters
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
from django.contrib.auth.models import User, Permission, Group, AnonymousUser from django.contrib.auth.models import User, Permission, Group, AnonymousUser

1
prednasky/views.py

@ -2,7 +2,6 @@ from django.shortcuts import render, get_object_or_404
from django.views import generic from django.views import generic
from django.shortcuts import HttpResponseRedirect from django.shortcuts import HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Sum
from django.forms import Form from django.forms import Form
from prednasky.models import Prednaska, Hlasovani, Seznam, STAV_NAVRH from prednasky.models import Prednaska, Hlasovani, Seznam, STAV_NAVRH

2
seminar/admin.py

@ -3,7 +3,7 @@ from django.db import models
from django.forms import widgets, ModelForm from django.forms import widgets, ModelForm
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
from solo.admin import SingletonModelAdmin from solo.admin import SingletonModelAdmin
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe

1
seminar/management/commands/load_org_permissions.py

@ -1,5 +1,4 @@
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
from django.contrib.auth.models import Group, Permission from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist

3
seminar/management/commands/save_org_permissions.py

@ -1,6 +1,5 @@
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session from django.contrib.auth.models import Group
from django.contrib.auth.models import Group, Permission
import json import json
class Command(BaseCommand): class Command(BaseCommand):

4
seminar/management/commands/testdata.py

@ -1,12 +1,10 @@
import datetime
import os import os
import random
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.core.management import call_command from django.core.management import call_command
from django.conf import settings from django.conf import settings
from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni, PrilohaReseni, Nastaveni from seminar.models import Skola, Resitel, Rocnik, Cislo, Problem, Reseni
from seminar.testutils import create_test_data from seminar.testutils import create_test_data
import django.contrib.auth import django.contrib.auth
User = django.contrib.auth.get_user_model() User = django.contrib.auth.get_user_model()

4
seminar/models/pomocne.py

@ -1,11 +1,7 @@
import logging
import os
from django.db import models from django.db import models
from .base import SeminarModelBase from .base import SeminarModelBase
logger = logging.getLogger(__name__)
class Text(SeminarModelBase): class Text(SeminarModelBase):
class Meta: class Meta:

4
seminar/models/treenode.py

@ -1,5 +1,3 @@
import logging
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
@ -12,8 +10,6 @@ from personalni.models import Organizator
from .pomocne import Text from .pomocne import Text
logger = logging.getLogger(__name__)
from seminar.models import tvorba as am from seminar.models import tvorba as am
class TreeNode(PolymorphicModel): class TreeNode(PolymorphicModel):

4
seminar/models/tvorba.py

@ -10,15 +10,13 @@ from django.db import models
from django.db.models import Q from django.db.models import Q
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils import timezone from django.utils import timezone
from django.conf import settings
from django.urls import reverse from django.urls import reverse
from django.core.cache import cache from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage
from django.utils.text import get_valid_filename from django.utils.text import get_valid_filename
from django.utils.functional import cached_property from django.utils.functional import cached_property
from solo.models import SingletonModel
from taggit.managers import TaggableManager from taggit.managers import TaggableManager
from reversion import revisions as reversion from reversion import revisions as reversion

3
seminar/templatetags/utils.py

@ -1,7 +1,6 @@
from django import template from django import template
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from datetime import datetime, timedelta from datetime import datetime
from mamweb.settings import TIME_ZONE
import logging import logging
register = template.Library() register = template.Library()

2
seminar/testutils.py

@ -10,7 +10,7 @@ import unidecode
import logging import logging
from korektury.testutils import create_test_pdf from korektury.testutils import create_test_pdf
from seminar.models import Skola, Resitel, Rocnik, Cislo, Deadline, Problem, Reseni, PrilohaReseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode, Novinky, TreeNode from seminar.models import Skola, Resitel, Rocnik, Cislo, Deadline, Problem, Reseni, Nastaveni, Soustredeni, Soustredeni_Ucastnici, Soustredeni_Organizatori, Osoba, Organizator, Prijemce, Tema, Uloha, Konfera, TextNode, UlohaVzorakNode, RocnikNode, CisloNode, TemaVCisleNode, Text, Hodnoceni, UlohaZadaniNode, Novinky
import seminar.models as m import seminar.models as m
from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.models import FlatPage

2
seminar/urls.py

@ -1,4 +1,4 @@
from django.urls import path, include, re_path from django.urls import path
from . import views from . import views
from .utils import org_required from .utils import org_required

4
seminar/utils.py

@ -12,13 +12,9 @@ from django.contrib.auth.models import AnonymousUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
import logging
import seminar.models as m import seminar.models as m
import treenode.treelib as t import treenode.treelib as t
logger = logging.getLogger(__name__)
org_required = permission_required('auth.org') org_required = permission_required('auth.org')
resitel_required = permission_required('auth.resitel') resitel_required = permission_required('auth.resitel')

11
seminar/views/views_all.py

@ -5,7 +5,7 @@ from django.core.exceptions import ObjectDoesNotExist
from django.views import generic from django.views import generic
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from django.http import Http404 from django.http import Http404
from django.db.models import Q, Sum, Count from django.db.models import Q
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.contrib.staticfiles.finders import find from django.contrib.staticfiles.finders import find
@ -17,25 +17,18 @@ from seminar.models import Problem, Cislo, Reseni, Nastaveni, Rocnik, \
Deadline # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci Deadline # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
#from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva #from .models import VysledkyZaCislo, VysledkyKCisluZaRocnik, VysledkyKCisluOdjakziva
from seminar import utils from seminar import utils
from treenode import treelib
import treenode.templatetags as tnltt
import treenode.serializers as vr
from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \ from vysledkovky.utils import body_resitelu, VysledkovkaCisla, \
VysledkovkaRocniku, VysledkovkaDoTeXu VysledkovkaRocniku, VysledkovkaDoTeXu
from datetime import date, datetime
from django.utils import timezone from django.utils import timezone
from itertools import groupby from itertools import groupby
from collections import OrderedDict from collections import OrderedDict
import tempfile import tempfile
import subprocess import subprocess
import shutil import shutil
import os
import os.path as op import os.path as op
from django.conf import settings from django.conf import settings
import unicodedata import unicodedata
import logging
import time
from collections.abc import Sequence from collections.abc import Sequence
import http import http
@ -51,8 +44,6 @@ from seminar.utils import aktivniResitele
#def temata_v_rocniku(rocnik): #def temata_v_rocniku(rocnik):
# return Problem.objects.filter(typ=Problem.TYP_TEMA, rocnik=rocnik) # return Problem.objects.filter(typ=Problem.TYP_TEMA, rocnik=rocnik)
logger = logging.getLogger(__name__)
def get_problemy_k_tematu(tema): def get_problemy_k_tematu(tema):
return Problem.objects.filter(nadproblem = tema) return Problem.objects.filter(nadproblem = tema)

1
soustredeni/views.py

@ -1,7 +1,6 @@
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import generic from django.views import generic
from django.conf import settings
from django.contrib.staticfiles.finders import find from django.contrib.staticfiles.finders import find
from seminar.models import Soustredeni, Resitel, Soustredeni_Ucastnici, Nastaveni # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci from seminar.models import Soustredeni, Resitel, Soustredeni_Ucastnici, Nastaveni # Tohle je stare a chceme se toho zbavit. Pouzivejte s.ToCoChci
import csv import csv

2
treenode/admin.py

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin, PolymorphicChildModelFilter from polymorphic.admin import PolymorphicParentModelAdmin, PolymorphicChildModelAdmin
import seminar.models as m import seminar.models as m

5
treenode/views.py

@ -13,11 +13,6 @@ import treenode.forms as f
import treenode.templatetags as tnltt import treenode.templatetags as tnltt
import treenode.serializers as vr import treenode.serializers as vr
import logging
logger = logging.getLogger(__name__)
class TNLData(object): class TNLData(object):
def __init__(self,anode,parent=None, index=None): def __init__(self,anode,parent=None, index=None):
self.node = anode self.node = anode

6
treenode/viewsets.py

@ -1,8 +1,6 @@
from rest_framework import viewsets,filters from rest_framework import viewsets
from rest_framework import status
from rest_framework.response import Response
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from rest_framework.permissions import BasePermission, AllowAny from rest_framework.permissions import AllowAny
from seminar import models as m from seminar import models as m
import treenode.serializers as views import treenode.serializers as views

1
various/admin.py

@ -1 +0,0 @@
from django.contrib import admin
Loading…
Cancel
Save