Skip to content
Snippets Groups Projects
Commit 506494d4 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files
parents 3bb7deae 8722ca2d
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ admin.site.register(Subject) ...@@ -12,7 +12,7 @@ admin.site.register(Subject)
admin.site.register(Visit) admin.site.register(Visit)
admin.site.register(Item) admin.site.register(Item)
admin.site.register(Room) admin.site.register(Room)
admin.site.register(AppType) admin.site.register(AppointmentType)
admin.site.register(Language, LanguageAdmin) admin.site.register(Language, LanguageAdmin)
admin.site.register(Worker) admin.site.register(Worker)
admin.site.register(FlyingTeam) admin.site.register(FlyingTeam)
......
...@@ -3,7 +3,7 @@ from django.forms import ModelForm ...@@ -3,7 +3,7 @@ from django.forms import ModelForm
from .models import * from .models import *
""" """
Redundancy? Maybe yes, but if need arises, contents of forms can be more easily customized Possibl redundancy, but if need arises, contents of forms can be easily customized
""" """
class SubjectAddForm(ModelForm): class SubjectAddForm(ModelForm):
...@@ -27,7 +27,8 @@ class SubjectEditForm(ModelForm): ...@@ -27,7 +27,8 @@ class SubjectEditForm(ModelForm):
class WorkerAddForm(ModelForm): class WorkerAddForm(ModelForm):
class Meta: class Meta:
model = Worker model = Worker
fields = '__all__' exclude = ['appointments']
#fields = '__all__'
class WorkerDetailForm(ModelForm): class WorkerDetailForm(ModelForm):
......
...@@ -74,14 +74,16 @@ class Subject(models.Model): ...@@ -74,14 +74,16 @@ class Subject(models.Model):
verbose_name='MPower ID' verbose_name='MPower ID'
) )
STATUS_CHOICES = ( STATUS_CHOICES = (
('INV', 'Invited'), ('NCO', 'Not contacted'),
('OPT', 'Opted out'),
('PAR', 'Participating'),
('TST', 'Test group'), ('TST', 'Test group'),
('LEA', 'Level A'),
('LEB', 'Level B'),
('OPT', 'Opted out'),
('DEA', 'Dead') ('DEA', 'Dead')
) )
subjectStatus = models.CharField(max_length=3, choices=STATUS_CHOICES, subjectStatus = models.CharField(max_length=3, choices=STATUS_CHOICES,
verbose_name='Status' verbose_name='Status',
default='NCO'
) )
mainPseudonym = models.CharField(max_length=45, mainPseudonym = models.CharField(max_length=45,
verbose_name='Pseudonym' verbose_name='Pseudonym'
...@@ -90,6 +92,15 @@ class Subject(models.Model): ...@@ -90,6 +92,15 @@ class Subject(models.Model):
verbose_name='Comments' verbose_name='Comments'
) )
dateAdded = models.DateField(verbose_name='Added on',
auto_now=True
)
referral = models.CharField(max_length=128,
null=True,
verbose_name='Referred by'
)
def __str__(self): def __str__(self):
return "%s %s" % (self.firstName, self.lastName) return "%s %s" % (self.firstName, self.lastName)
...@@ -106,15 +117,19 @@ class Visit(models.Model): ...@@ -106,15 +117,19 @@ class Visit(models.Model):
) )
visitEnd = models.DateTimeField( visitEnd = models.DateTimeField(
verbose_name='Visit ends at' verbose_name='Visit ends at'
) # Deadline before which all appointments need to be scheduled
TYPE_CHOICES = (
('A', 'Level A visit'),
('B', 'Level B visit'),
('O', 'Other')
) )
assesmentNo = models.IntegerField( visitType = models.CharField(max_length=1, choices=TYPE_CHOICES,
verbose_name='Which assesment' verbose_name='Visit type',
) default='O'
visitType = models.IntegerField(
verbose_name='Type of visit'
) )
visitFinished = models.BooleanField( visitFinished = models.BooleanField(
verbose_name='Has ended' verbose_name='Has ended',
default=False
) )
def __str__(self): def __str__(self):
...@@ -138,7 +153,7 @@ class Item (models.Model): ...@@ -138,7 +153,7 @@ class Item (models.Model):
class Room (models.Model): class Room (models.Model):
possEquipment = models.ManyToManyField(Item, possEquipment = models.ManyToManyField(Item,
verbose_name='On-site equipment', verbose_name='On-site equipment',
null=True, blank=True blank=True
) )
owner = models.CharField(max_length=50, owner = models.CharField(max_length=50,
verbose_name='Owner' verbose_name='Owner'
...@@ -162,24 +177,20 @@ class Room (models.Model): ...@@ -162,24 +177,20 @@ class Room (models.Model):
def __str__(self): def __str__(self):
return "%d %s %s" % (self.roomNo, self.address, self.city) return "%d %s %s" % (self.roomNo, self.address, self.city)
class AppType (models.Model): class AppointmentType (models.Model):
reqEquipment = models.ManyToManyField(Item, requiredEquipment = models.ManyToManyField(Item,
verbose_name='Required equipment' verbose_name='Required equipment'
) )
followUp = models.ForeignKey('self', code = models.CharField(max_length=20,
verbose_name='Follow-up visit',
null=True, blank=True
)
apCode = models.CharField(max_length=20,
verbose_name='Appointment code' verbose_name='Appointment code'
) )
apDescription = models.CharField(max_length=2000, description = models.CharField(max_length=2000,
verbose_name='Appointment description' verbose_name='Appointment description'
) )
apDefaultTime = models.IntegerField( defaultTime = models.IntegerField(
verbose_name='Default time' verbose_name='Default time'
) )
apRestTime = models.IntegerField( restTime = models.IntegerField(
verbose_name='Suggested rest time' verbose_name='Suggested rest time'
) )
...@@ -283,7 +294,8 @@ class Avaibility(models.Model): ...@@ -283,7 +294,8 @@ class Avaibility(models.Model):
verbose_name='Avaible until' verbose_name='Avaible until'
) )
current = models.BooleanField( current = models.BooleanField(
verbose_name='Is current?' verbose_name='Is current?',
default=True
) )
def __str__(self): def __str__(self):
...@@ -308,8 +320,13 @@ class Appointment(models.Model): ...@@ -308,8 +320,13 @@ class Appointment(models.Model):
verbose_name='Flying team (if applicable)', verbose_name='Flying team (if applicable)',
null=True, blank=True null=True, blank=True
) )
appType = models.ForeignKey(AppType, workerAssigned = models.ForeignKey(Worker,
verbose_name='Appointment type' verbose_name='Worker conducting the assessment (if applicable)',
null=True, blank=True
)
appointmentType = models.ForeignKey(AppointmentType,
verbose_name='Appointment type',
null=True, blank=True
) )
room = models.ForeignKey(Room, room = models.ForeignKey(Room,
verbose_name='Room ID' verbose_name='Room ID'
...@@ -322,7 +339,8 @@ class Appointment(models.Model): ...@@ -322,7 +339,8 @@ class Appointment(models.Model):
) )
appLength = models.IntegerField( appLength = models.IntegerField(
verbose_name='Appointment length' verbose_name='Appointment length'
) )#Potentially redundant; but can be used to manually adjust appointment's length
appFinished = models.BooleanField( appFinished = models.BooleanField(
verbose_name='Has the appointment ended?' verbose_name='Has the appointment ended?',
default=False
) )
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