Skip to content
Snippets Groups Projects
Commit c0058f4b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

subject list contain information about type of subject list

parent c84778d4
No related branches found
No related tags found
1 merge request!129Resolve "list shown after clicking on notifications"
......@@ -9,7 +9,7 @@ SUBJECT_LIST_REQUIRE_CONTACT = "REQUIRE_CONTACT"
SUBJECT_LIST_VOUCHER_EXPIRY = "VOUCHER_EXPIRY"
SUBJECT_LIST_CHOICES = {
SUBJECT_LIST_GENERIC: 'Generic',
SUBJECT_LIST_GENERIC: 'Generic subject list',
SUBJECT_LIST_NO_VISIT: 'Subjects without visit',
SUBJECT_LIST_REQUIRE_CONTACT: 'Subjects required contact',
SUBJECT_LIST_VOUCHER_EXPIRY: 'Subject with vouchers to be expired soon'
......
......@@ -8,10 +8,10 @@
{% endblock styles %}
{% block ui_active_tab %}'subjects'{% endblock ui_active_tab %}
{% block page_header %}Subjects{% endblock page_header %}
{% block page_header %}{{ list_description }}{% endblock page_header %}
{% block page_description %}{% endblock page_description %}
{% block title %}{{ block.super }} - Subjects{% endblock %}
{% block title %}{{ block.super }} - {{ list_description }}{% endblock %}
{% block breadcrumb %}
{% include "subjects/breadcrumb.html" %}
......
......@@ -9,19 +9,24 @@ from ..forms import VisitDetailForm, SubjectAddForm, SubjectEditForm, StudySubje
from ..models import StudySubject, MailTemplate, Worker, Study
from ..models.constants import GLOBAL_STUDY_ID
from ..models.study_subject_list import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT, \
SUBJECT_LIST_VOUCHER_EXPIRY
SUBJECT_LIST_VOUCHER_EXPIRY, SUBJECT_LIST_CHOICES
logger = logging.getLogger(__name__)
def subjects(request):
def subject_list(request, subject_list_type):
context = {
'list_type': SUBJECT_LIST_GENERIC,
'worker': Worker.get_by_user(request.user)
'list_type': subject_list_type,
'worker': Worker.get_by_user(request.user),
'list_description': SUBJECT_LIST_CHOICES[subject_list_type],
}
return wrap_response(request, 'subjects/index.html', context)
def subjects(request):
return subject_list(request, SUBJECT_LIST_GENERIC)
def subject_add(request):
study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
if request.method == 'POST':
......@@ -47,24 +52,15 @@ def subject_add(request):
def subject_no_visits(request):
context = {
'list_type': SUBJECT_LIST_NO_VISIT,
}
return wrap_response(request, 'subjects/index.html', context)
return subject_list(request, SUBJECT_LIST_NO_VISIT)
def subject_voucher_expiry(request):
context = {
'list_type': SUBJECT_LIST_VOUCHER_EXPIRY,
}
return wrap_response(request, 'subjects/index.html', context)
return subject_list(request, SUBJECT_LIST_VOUCHER_EXPIRY)
def subject_require_contact(request):
context = {
'list_type': SUBJECT_LIST_REQUIRE_CONTACT,
}
return wrap_response(request, 'subjects/index.html', context)
return subject_list(request, SUBJECT_LIST_REQUIRE_CONTACT)
def subject_edit(request, id):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment