Stripped personal data from development repository
Samo Penic
2019-02-20 83c3f647c35477564b77cbc5b36d37d793d5442a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
3
¤[\ö ã@s<ddlmZddlmZddlmZddlmZmZddl    m
Z
ddl m Z ddl mZdd    lmZdd
lmZdd lmZdd lmZdd lmZddlmZddlmZe
e dd„ƒƒZe
e dd„ƒƒZee ddGdd„deejƒƒZee ddGdd„deej ej!ƒƒZ"e
e edd„ƒƒƒZ#e
e edd„ƒƒƒZ$dS)é)Úrender)Ú HttpResponse)Úloaderé)ÚProblemÚ ProblemGroup)Úlogin_required)Ústaff_member_required)Ú csrf_exempt)ÚExam)Ú JsonResponse)Úmethod_decorator)Úgeneric)ÚLoginRequiredMixin)ÚProblemGroupForm)ÚreversecCs,tjdƒ}tjjƒ}d|i}t|j||ƒƒS)Nzproblem/index.htmlÚ problem_list)rÚ get_templaterÚobjectsÚallrr)ÚrequestÚtemplaterÚcontext©rú>/home/samo/programiranje/django/sizif-web/aoi/problem/views.pyÚindexs
 
rcCs4tjdƒ}tjjddjƒ}d|i}t|j||ƒƒS)Nzproblem/problemgroups.htmlF)ÚproblemhomegroupÚproblemgroup_list)rrrrÚfilterrrr)rrrrrrrÚproblemgrouplists
rÚdispatch)Únamec@seZdZeZdZdd„ZdS)ÚProblemGroupNewViewzproblem/problemgroup_new.htmlcCs tdfdS)Nr)Úargs)r)ÚselfrrrÚget_success_url-sz#ProblemGroupNewView.get_success_urlN)Ú__name__Ú
__module__Ú __qualname__rÚ
form_classÚ template_namer%rrrrr"(sr"cs0eZdZeZeZdZdd„Z‡fdd„Z    ‡Z
S)ÚProblemGroupDetailViewzproblem/problemgroup_new.htmlcCstd|jjfdS)NÚproblemgroupdetail)r#)rÚobjectÚpk)r$rrrr%7sz&ProblemGroupDetailView.get_success_urlc stt|ƒjf|Ž}d|d<|S)NzThis is just some dataZ    some_data)Úsuperr+Úget_context_data)r$Úkwargsr)Ú    __class__rrr0:sz'ProblemGroupDetailView.get_context_data) r&r'r(rÚmodelrr)r*r%r0Ú __classcell__rr)r2rr+1s
r+c    Cspddl}tjj|d}|jjdƒ}ytjj|d}Wnd}YnX|dkrZtddiƒS|j|ƒtddiƒS)Nr)r.Ú selected_examÚstatusÚFailÚOK)ÚjsonrrÚgetÚsessionr r Ú add_problem)rr.r9ÚproblemÚexam_idÚexamrrrÚaddProblemToExamDs 
 
r@c    Csrddl}tjj|d}|jjdƒ}ytjj|d}Wnd}YnX|dkrZtddiƒS|jj|ƒtddiƒS)Nr)r.r5r6r7r8)    r9rrr:r;r r Ú problem_groupÚadd)rr.r9Úgroupr>r?rrrÚaddProblemGroupToExamUs 
  rDN)%Údjango.shortcutsrÚ django.httprÚdjango.templaterÚmodelsrrÚdjango.contrib.auth.decoratorsrÚ%django.contrib.admin.views.decoratorsr    Údjango.views.decorators.csrfr
Z exam.modelsr r Údjango.utils.decoratorsr Z django.viewsrÚdjango.contrib.auth.mixinsrÚformsrÚ django.urlsrrrÚ
CreateViewr"Ú
UpdateViewÚ
DetailViewr+r@rDrrrrÚ<module>s6