Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • smasch/scheduling-system
1 result
Show changes
Commits on Source (41)
Showing
with 440 additions and 202 deletions
......@@ -72,7 +72,8 @@ TEMPLATES = [
CRON_CLASSES = [
'web.views.kit.KitRequestEmailSendJob',
'web.redcap_connector.RedCapRefreshJob'
'web.redcap_connector.RedCapRefreshJob',
'web.voucher_expiry_job',
]
# Password validation
......
......@@ -8,6 +8,7 @@ from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from web.models import Appointment, AppointmentTypeLink, Worker, Availability, Holiday
from web.models.worker_study_role import WORKER_STAFF
from web.views import e500_error
from web.views.notifications import get_filter_locations
......@@ -300,9 +301,9 @@ def events(request, date):
def get_workers_for_daily_planning(request):
result = Worker.objects.filter(locations__in=get_filter_locations(request.user)). \
filter(user__is_active=True).exclude(
role=Worker.ROLE_CHOICES_SECRETARY).distinct()
result = Worker.get_workers_by_worker_type(WORKER_STAFF).filter(
locations__in=get_filter_locations(request.user)).filter(
user__is_active=True).distinct()
return result
......
......@@ -10,9 +10,10 @@ from web.api_views.serialization_utils import bool_to_yes_no, flying_team_to_str
from web.models import StudySubject, Visit, Appointment, Subject, SubjectColumns, StudyColumns, Study, ContactAttempt
from web.models.constants import SUBJECT_TYPE_CHOICES, GLOBAL_STUDY_ID
from web.models.study_subject_list import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT, \
StudySubjectList
StudySubjectList, SUBJECT_LIST_VOUCHER_EXPIRY
from web.views import e500_error
from web.views.notifications import get_subjects_with_no_visit, get_subjects_with_reminder, get_today_midnight_date
from web.views.notifications import get_subjects_with_no_visit, get_subjects_with_reminder, get_today_midnight_date, \
get_subjects_with_almost_expired_vouchers
logger = logging.getLogger(__name__)
......@@ -89,6 +90,8 @@ def get_subjects(request, type):
return get_subjects_with_no_visit(request.user)
elif type == SUBJECT_LIST_REQUIRE_CONTACT:
return get_subjects_with_reminder(request.user)
elif type == SUBJECT_LIST_VOUCHER_EXPIRY:
return get_subjects_with_almost_expired_vouchers(request.user)
else:
raise TypeError("Unknown query type: " + type)
......
......@@ -4,6 +4,7 @@ from django.contrib.auth.decorators import login_required
from django.http import JsonResponse
from django.utils import timezone
from web.models.constants import GLOBAL_STUDY_ID
from web.api_views.daily_planning import get_workers_for_daily_planning, get_availabilities
from ..models import Worker
......@@ -29,10 +30,11 @@ def workers_for_daily_planning(request):
workers = get_workers_for_daily_planning(request)
workers_list_for_json = []
for worker in workers:
role = unicode(worker.roles.filter(study_id=GLOBAL_STUDY_ID)[0].role)
worker_dict_for_json = {
'id': worker.id,
'title': u"{} ({})".format(unicode(worker), worker.get_role_display()[:1].upper()),
'role': worker.get_role_display()
'title': u"{} ({})".format(unicode(worker), role[:1].upper()),
'role': role
}
workers_list_for_json.append(worker_dict_for_json)
return JsonResponse(workers_list_for_json, safe=False)
......
from forms import WorkerAddForm, \
WorkerEditForm, AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm, VisitDetailForm, VisitAddForm, \
ContactAttemptForm, ContactAttemptEditForm, KitRequestForm, StatisticsForm, AvailabilityAddForm, \
from worker_form import WorkerForm
from forms import VisitDetailForm, \
VisitAddForm, KitRequestForm, StatisticsForm, AvailabilityAddForm, \
AvailabilityEditForm, HolidayAddForm
from contact_attempt_forms import ContactAttemptAddForm, ContactAttemptEditForm
from appointment_form import AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm
from study_subject_forms import StudySubjectAddForm, StudySubjectDetailForm, StudySubjectEditForm
from subject_forms import SubjectAddForm, SubjectEditForm, SubjectDetailForm
from voucher_forms import VoucherTypeForm, VoucherTypePriceForm, VoucherForm
__all__ = [StudySubjectAddForm, StudySubjectDetailForm, StudySubjectEditForm, WorkerAddForm, WorkerEditForm,
__all__ = [StudySubjectAddForm, StudySubjectDetailForm, StudySubjectEditForm, WorkerForm,
AppointmentDetailForm, AppointmentEditForm, AppointmentAddForm, VisitDetailForm, VisitAddForm,
ContactAttemptForm, ContactAttemptEditForm, KitRequestForm, StatisticsForm, AvailabilityAddForm,
ContactAttemptAddForm, ContactAttemptEditForm, KitRequestForm, StatisticsForm, AvailabilityAddForm,
AvailabilityEditForm, HolidayAddForm, SubjectAddForm, SubjectEditForm, SubjectDetailForm, VoucherTypeForm,
VoucherTypePriceForm, VoucherForm]
import logging
from collections import OrderedDict
from django import forms
from django.forms import ModelForm
from web.models.worker_study_role import WORKER_STAFF
from web.forms.forms import DATETIMEPICKER_DATE_ATTRS, APPOINTMENT_TYPES_FIELD_POSITION
from web.models import Appointment, Worker, AppointmentTypeLink, AppointmentType
from web.views.notifications import get_filter_locations
logger = logging.getLogger(__name__)
class AppointmentForm(ModelForm):
datetime_when = forms.DateTimeField(label='Appointment on',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
super(AppointmentForm, self).__init__(*args, **kwargs)
self.fields['worker_assigned'].queryset = Worker.get_workers_by_worker_type(WORKER_STAFF).filter(
locations__in=get_filter_locations(self.user)).distinct().order_by('first_name', 'last_name')
class AppointmentDetailForm(AppointmentForm):
class Meta:
model = Appointment
fields = '__all__'
class AppointmentEditForm(AppointmentForm):
class Meta:
model = Appointment
fields = '__all__'
exclude = ['appointment_types']
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(AppointmentEditForm, self).__init__(*args, **kwargs)
if 'instance' in kwargs:
initial_appointment_types = AppointmentTypeLink.objects.filter(appointment=kwargs['instance']).values_list(
'appointment_type', flat=True)
else:
initial_appointment_types = []
fields = OrderedDict()
for i, tuple in enumerate(self.fields.items()):
key, value = tuple
fields[key] = value
if i == APPOINTMENT_TYPES_FIELD_POSITION:
fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple,
queryset=AppointmentType.objects.all(),
initial=initial_appointment_types)
self.fields = fields
self.fields['location'].queryset = get_filter_locations(self.user)
def clean_location(self):
location = self.cleaned_data['location']
if self.user.locations.filter(id=location.id).count() == 0:
self.add_error('location', "You cannot create appointment for this location")
else:
return location
def save(self, commit=True):
appointment = super(AppointmentEditForm, self).save(commit)
# if appointment date change, remove appointment_type links
if 'datetime_when' in self.changed_data:
AppointmentTypeLink.objects.filter(appointment=appointment).delete()
appointment_type_links = []
else:
appointment_type_links = AppointmentTypeLink.objects.filter(appointment=appointment).all()
appointment_types_from_links = []
appointment_types = self.cleaned_data['appointment_types']
for appointment_type_link in appointment_type_links:
if appointment_type_link.appointment_type not in appointment_types:
# we delete appointment links for appointments types that have been removed
appointment_type_link.delete()
else:
appointment_types_from_links.append(appointment_type_link.appointment_type)
for appointment_type in appointment_types:
if appointment_type not in appointment_types_from_links:
# we create new appointment links for appointments types that have been added
appointment_type_link = AppointmentTypeLink(appointment=appointment,
appointment_type=appointment_type)
appointment_type_link.save()
return appointment
class AppointmentAddForm(AppointmentForm):
class Meta:
model = Appointment
exclude = ['status', 'appointment_types']
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(AppointmentAddForm, self).__init__(*args, **kwargs)
fields = OrderedDict()
for i, tuple in enumerate(self.fields.items()):
key, value = tuple
fields[key] = value
if i == APPOINTMENT_TYPES_FIELD_POSITION:
fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple,
queryset=AppointmentType.objects.all(),
)
self.fields = fields
self.fields['location'].queryset = get_filter_locations(self.user)
def clean_location(self):
location = self.cleaned_data['location']
if self.user.locations.filter(id=location.id).count() == 0:
self.add_error('location', "You cannot create appointment for this location")
else:
return location
def save(self, commit=True):
appointment = super(AppointmentAddForm, self).save(commit)
appointment_types = self.cleaned_data['appointment_types']
for appointment_type in appointment_types:
appointment_type_link = AppointmentTypeLink(appointment=appointment, appointment_type=appointment_type)
appointment_type_link.save()
return appointment
from django import forms
from django.forms import ModelForm
from web.forms.forms import DATETIMEPICKER_DATE_ATTRS
from web.models import ContactAttempt, Worker
from web.models.worker_study_role import WORKER_STAFF
class ContactAttemptForm(ModelForm):
datetime_when = forms.DateTimeField(label='When? (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(ContactAttemptForm, self).__init__(*args, **kwargs)
self.fields['subject'].disabled = True
self.fields['worker'].queryset = Worker.get_workers_by_worker_type(WORKER_STAFF).distinct().order_by(
'first_name', 'last_name')
class ContactAttemptAddForm(ContactAttemptForm):
class Meta:
model = ContactAttempt
fields = '__all__'
def __init__(self, *args, **kwargs):
subject = kwargs.pop('subject', None)
super(ContactAttemptAddForm, self).__init__(*args, **kwargs)
self.fields['subject'].initial = subject.id
self.fields['worker'].initial = self.user
class ContactAttemptEditForm(ContactAttemptForm):
class Meta:
model = ContactAttempt
fields = '__all__'
def __init__(self, *args, **kwargs):
super(ContactAttemptEditForm, self).__init__(*args, **kwargs)
import datetime
import logging
from collections import OrderedDict
from django import forms
from django.forms import ModelForm, Form
......@@ -10,7 +9,6 @@ from web.models import Appointment, AppointmentType, AppointmentTypeLink, \
Availability, ContactAttempt, FlyingTeam, Holiday, StudySubject, \
Worker, Visit, VoucherType, VoucherTypePrice
from web.models.constants import SUBJECT_TYPE_CHOICES
from web.views.notifications import get_filter_locations
"""
Possible redundancy, but if need arises, contents of forms can be easily customized
......@@ -50,145 +48,6 @@ def get_worker_from_args(kwargs):
return result
class WorkerAddForm(ModelForm):
class Meta:
model = Worker
exclude = ['appointments']
class WorkerEditForm(ModelForm):
class Meta:
model = Worker
fields = '__all__'
class AppointmentDetailForm(ModelForm):
class Meta:
model = Appointment
fields = '__all__'
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
class AppointmentEditForm(ModelForm):
class Meta:
model = Appointment
fields = '__all__'
exclude = ['appointment_types']
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(ModelForm, self).__init__(*args, **kwargs)
if 'instance' in kwargs:
initial_appointment_types = AppointmentTypeLink.objects.filter(appointment=kwargs['instance']).values_list(
'appointment_type', flat=True)
else:
initial_appointment_types = []
fields = OrderedDict()
for i, tuple in enumerate(self.fields.items()):
key, value = tuple
fields[key] = value
if i == APPOINTMENT_TYPES_FIELD_POSITION:
fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple,
queryset=AppointmentType.objects.all(),
initial=initial_appointment_types)
self.fields = fields
self.fields['worker_assigned'].queryset = Worker.objects.filter(
locations__in=get_filter_locations(self.user)).distinct().order_by('first_name', 'last_name')
self.fields['location'].queryset = get_filter_locations(self.user)
def clean_location(self):
location = self.cleaned_data['location']
if self.user.locations.filter(id=location.id).count() == 0:
self.add_error('location', "You cannot create appointment for this location")
else:
return location
def save(self, commit=True):
appointment = super(AppointmentEditForm, self).save(commit)
# if appointment date change, remove appointment_type links
if 'datetime_when' in self.changed_data:
AppointmentTypeLink.objects.filter(appointment=appointment).delete()
appointment_type_links = []
else:
appointment_type_links = AppointmentTypeLink.objects.filter(appointment=appointment).all()
appointment_types_from_links = []
appointment_types = self.cleaned_data['appointment_types']
for appointment_type_link in appointment_type_links:
if appointment_type_link.appointment_type not in appointment_types:
# we delete appointment links for appointments types that have been removed
appointment_type_link.delete()
else:
appointment_types_from_links.append(appointment_type_link.appointment_type)
for appointment_type in appointment_types:
if appointment_type not in appointment_types_from_links:
# we create new appointment links for appointments types that have been added
appointment_type_link = AppointmentTypeLink(appointment=appointment,
appointment_type=appointment_type)
appointment_type_link.save()
return appointment
class AppointmentAddForm(ModelForm):
class Meta:
model = Appointment
exclude = ['status', 'appointment_types']
datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(ModelForm, self).__init__(*args, **kwargs)
fields = OrderedDict()
for i, tuple in enumerate(self.fields.items()):
key, value = tuple
fields[key] = value
if i == APPOINTMENT_TYPES_FIELD_POSITION:
fields['appointment_types'] = forms.ModelMultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple,
queryset=AppointmentType.objects.all(),
)
self.fields = fields
self.fields['worker_assigned'].queryset = Worker.objects.filter(
locations__in=get_filter_locations(self.user)).distinct().order_by('first_name', 'last_name')
self.fields['location'].queryset = get_filter_locations(self.user)
def clean_location(self):
location = self.cleaned_data['location']
if self.user.locations.filter(id=location.id).count() == 0:
self.add_error('location', "You cannot create appointment for this location")
else:
return location
def save(self, commit=True):
appointment = super(AppointmentAddForm, self).save(commit)
appointment_types = self.cleaned_data['appointment_types']
for appointment_type in appointment_types:
appointment_type_link = AppointmentTypeLink(appointment=appointment, appointment_type=appointment_type)
appointment_type_link.save()
return appointment
class VisitDetailForm(ModelForm):
datetime_begin = forms.DateField(label="Visit begins on",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d")
......@@ -231,49 +90,6 @@ class VisitAddForm(ModelForm):
self.add_error('datetime_end', "End date must be after start date")
class ContactAttemptForm(ModelForm):
datetime_when = forms.DateTimeField(label='When? (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
class Meta:
model = ContactAttempt
fields = '__all__'
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
subject = kwargs.pop('subject', None)
super(ContactAttemptForm, self).__init__(*args, **kwargs)
self.fields['subject'].initial = subject.id
self.fields['subject'].disabled = True
self.fields['worker'].initial = self.user
class ContactAttemptEditForm(ModelForm):
datetime_when = forms.DateTimeField(label='When? (YYYY-MM-DD HH:MM)',
widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS)
)
class Meta:
model = ContactAttempt
fields = '__all__'
def __init__(self, *args, **kwargs):
user = kwargs.pop('user', None)
if user is None:
raise TypeError("User not defined")
self.user = Worker.get_by_user(user)
if self.user is None:
raise TypeError("Worker not defined for: " + user.username)
super(ContactAttemptEditForm, self).__init__(*args, **kwargs)
self.fields['subject'].disabled = True
class KitRequestForm(Form):
start_date = forms.DateField(label="From date",
widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"),
......@@ -398,5 +214,3 @@ class HolidayAddForm(ModelForm):
availabilities = worker.availability_set.all()
for availability in availabilities:
validate_availability_conflict(self, self.cleaned_data, availability)
......@@ -5,8 +5,9 @@ from django import forms
from django.forms import ModelForm
from web.forms.forms import DATETIMEPICKER_DATE_ATTRS, get_worker_from_args
from web.models import StudySubject, Study, StudyColumns, VoucherType
from web.models import StudySubject, Study, StudyColumns, VoucherType, Worker
from web.models.constants import SCREENING_NUMBER_PREFIXES_FOR_TYPE
from web.models.worker_study_role import WORKER_HEALTH_PARTNER
from web.widgets.secure_file_widget import SecuredFileWidget
logger = logging.getLogger(__name__)
......@@ -27,6 +28,7 @@ class StudySubjectForm(ModelForm):
def __init__(self, *args, **kwargs):
super(StudySubjectForm, self).__init__(*args, **kwargs)
self.fields['health_partner'].queryset = Worker.get_workers_by_worker_type(WORKER_HEALTH_PARTNER)
class StudySubjectAddForm(StudySubjectForm):
......
......@@ -7,8 +7,9 @@ from django.utils import timezone
from web.algorithm import VerhoeffAlgorithm
from web.forms.forms import DATEPICKER_DATE_ATTRS
from web.models import VoucherType, VoucherTypePrice, Voucher
from web.models import VoucherType, VoucherTypePrice, Voucher, Worker
from web.models.constants import VOUCHER_STATUS_NEW, VOUCHER_STATUS_USED
from web.models.worker_study_role import WORKER_VOUCHER_PARTNER
logger = logging.getLogger(__name__)
......@@ -42,6 +43,7 @@ class VoucherForm(ModelForm):
super(VoucherForm, self).__init__(*args, **kwargs)
self.fields['voucher_type'].queryset = voucher_types
self.fields['usage_partner'].queryset = Worker.get_workers_by_worker_type(WORKER_VOUCHER_PARTNER)
self.fields['number'].widget.attrs['readonly'] = True
self.fields['number'].required = False
......@@ -54,6 +56,9 @@ class VoucherForm(ModelForm):
instance = getattr(self, 'instance', None)
if instance and instance.pk:
self.fields['voucher_type'].widget.attrs['readonly'] = True
self.fields['usage_partner'].queryset = Worker.get_workers_by_worker_type(WORKER_VOUCHER_PARTNER).filter(
voucher_types = instance.voucher_type)
if instance.status != VOUCHER_STATUS_NEW:
self.fields['status'].widget.attrs['readonly'] = True
self.fields['feedback'].widget.attrs['readonly'] = True
......
import logging
from django import forms
from django.forms import ModelForm
from web.models import Worker, WorkerStudyRole
from web.models.constants import GLOBAL_STUDY_ID
from web.models.worker import role_choices_by_worker_type, worker_type_by_worker
from web.models.worker_study_role import WORKER_STAFF
logger = logging.getLogger(__name__)
class WorkerForm(ModelForm):
class Meta:
model = Worker
exclude = ['appointments']
def __init__(self, *args, **kwargs):
worker_type = kwargs.pop('worker_type', WORKER_STAFF)
super(WorkerForm, self).__init__(*args, **kwargs)
instance = getattr(self, 'instance', None)
initial_role = None
if instance is not None and instance.pk:
worker_type = worker_type_by_worker(instance)
roles = WorkerStudyRole.objects.filter(worker=instance, study_id=GLOBAL_STUDY_ID)
if roles.count() > 0:
initial_role = roles[0].role
choices = role_choices_by_worker_type(worker_type)
self.fields['role'] = forms.ChoiceField(label='Role', choices=choices)
self.fields['role'].initial = initial_role
if worker_type == WORKER_STAFF:
del self.fields['voucher_types']
else:
del self.fields['locations']
del self.fields['user']
def save(self, commit=True):
instance = super(WorkerForm, self).save(commit)
roles = WorkerStudyRole.objects.filter(worker=instance, study_id=GLOBAL_STUDY_ID)
if roles.count() > 0:
roles.update(role=self.cleaned_data['role'])
else:
WorkerStudyRole.objects.create(worker=instance, study_id=GLOBAL_STUDY_ID, role=self.cleaned_data['role'])
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-12 14:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('web', '0097_auto_20171211_1616'),
]
operations = [
migrations.CreateModel(
name='WorkerStudyRole',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role', models.CharField(choices=[(b'DOCTOR', b'Doctor'), (b'NURSE', b'Nurse'), (b'PSYCHOLOGIST', b'Psychologist'), (b'TECHNICIAN', b'Technician'), (b'SECRETARY', b'Secretary')], max_length=20, verbose_name=b'Role')),
('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='web.Study')),
('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='roles', to='web.Worker')),
],
),
migrations.RunSQL('insert into web_workerstudyrole (study_id, worker_id, role) '+
'select 1, id, role from web_worker;'),
migrations.RemoveField(
model_name='worker',
name='role',
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-13 11:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0098_workerstudyrole'),
]
operations = [
migrations.AlterField(
model_name='worker',
name='languages',
field=models.ManyToManyField(blank=True, to='web.Language', verbose_name=b'Known languages'),
),
migrations.AlterField(
model_name='worker',
name='locations',
field=models.ManyToManyField(blank=True, to='web.Location', verbose_name=b'Locations'),
),
migrations.AlterField(
model_name='worker',
name='phone_number',
field=models.CharField(blank=True, max_length=20, verbose_name=b'Phone number'),
),
migrations.AlterField(
model_name='worker',
name='specialization',
field=models.CharField(blank=True, max_length=20, verbose_name=b'Specialization'),
),
migrations.AlterField(
model_name='worker',
name='unit',
field=models.CharField(blank=True, max_length=50, verbose_name=b'Unit'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-13 11:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('web', '0099_auto_20171213_1115'),
]
operations = [
migrations.AddField(
model_name='worker',
name='address',
field=models.CharField(blank=True, max_length=255, verbose_name=b'Address'),
),
migrations.AddField(
model_name='worker',
name='city',
field=models.CharField(blank=True, max_length=50, verbose_name=b'City'),
),
migrations.AddField(
model_name='worker',
name='country',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='web.Country', verbose_name=b'Country'),
),
migrations.AddField(
model_name='worker',
name='fax_number',
field=models.CharField(blank=True, max_length=20, verbose_name=b'Fax number'),
),
migrations.AddField(
model_name='worker',
name='phone_number_2',
field=models.CharField(blank=True, max_length=20, verbose_name=b'Phone number 2'),
),
migrations.AddField(
model_name='worker',
name='postal_code',
field=models.CharField(blank=True, max_length=7, verbose_name=b'Postal code'),
),
migrations.AddField(
model_name='worker',
name='voucher_types',
field=models.ManyToManyField(blank=True, to='web.VoucherType', verbose_name=b'Voucher types'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-14 10:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0100_auto_20171213_1140'),
]
operations = [
migrations.AddField(
model_name='study',
name='auto_create_follow_up',
field=models.BooleanField(default=True, verbose_name=b'Auto create follow up visit'),
),
migrations.AlterField(
model_name='worker',
name='email',
field=models.EmailField(blank=True, max_length=254, verbose_name=b'E-mail'),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-14 12:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0101_auto_20171214_1047'),
]
operations = [
migrations.AddField(
model_name='studynotificationparameters',
name='subject_voucher_expiry_visible',
field=models.BooleanField(default=False, verbose_name=b'subject vouchers almost expired'),
),
]
......@@ -19,6 +19,7 @@ from voucher_type_price import VoucherTypePrice
from room import Room
from visit import Visit
from worker import Worker
from worker_study_role import WorkerStudyRole
from appointment import Appointment
from appointment_type import AppointmentType
from availability import Availability
......@@ -39,5 +40,5 @@ from inconsistent_subject import InconsistentSubject, InconsistentField
__all__ = [Study, FlyingTeam, Appointment, AppointmentType, Availability, Holiday, Item, Language, Location, Room,
Subject, StudySubject, StudySubjectList, SubjectColumns, StudyNotificationParameters,
AppointmentList, AppointmentColumns, Visit, Worker, ContactAttempt, ConfigurationItem, MailTemplate,
AppointmentTypeLink, VoucherType, VoucherTypePrice, Voucher,
AppointmentTypeLink, VoucherType, VoucherTypePrice, Voucher, WorkerStudyRole,
MissingSubject, InconsistentSubject, InconsistentField, Country, StudyColumns, VisitColumns, StudyVisitList]
......@@ -31,6 +31,11 @@ class StudyNotificationParameters(models.Model):
verbose_name='subject without visit',
)
subject_voucher_expiry_visible = models.BooleanField(
default=False,
verbose_name='subject vouchers almost expired',
)
unfinished_visits_visible = models.BooleanField(
default=True,
verbose_name='unfinished visits',
......
......@@ -19,6 +19,11 @@ class Study(models.Model):
on_delete=models.CASCADE,
)
auto_create_follow_up = models.BooleanField(
default=True,
verbose_name="Auto create follow up visit"
)
def __str__(self):
return "%s" % self.name
......
......@@ -6,11 +6,13 @@ from web.models import Study, SubjectColumns, StudyColumns
SUBJECT_LIST_GENERIC = "GENERIC"
SUBJECT_LIST_NO_VISIT = "NO_VISIT"
SUBJECT_LIST_REQUIRE_CONTACT = "REQUIRE_CONTACT"
SUBJECT_LIST_VOUCHER_EXPIRY = "VOUCHER_EXPIRY"
SUBJECT_LIST_CHOICES = {
SUBJECT_LIST_GENERIC: 'Generic',
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'
}
......