Skip to content

Commit c9b5f5c

Browse files
committed
some more minor changes
1 parent 613eff3 commit c9b5f5c

File tree

8 files changed

+146
-11
lines changed

8 files changed

+146
-11
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Generated by Django 3.2.12 on 2022-03-12 13:42
2+
3+
import datetime
4+
from django.db import migrations, models
5+
from django.utils.timezone import utc
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('facilities', '0009_auto_20220304_2237'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='facility',
17+
name='created_at',
18+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 775102, tzinfo=utc)),
19+
),
20+
migrations.AlterField(
21+
model_name='localbody',
22+
name='created_at',
23+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 774451, tzinfo=utc)),
24+
),
25+
migrations.AlterField(
26+
model_name='state',
27+
name='created_at',
28+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 773814, tzinfo=utc)),
29+
),
30+
migrations.AlterField(
31+
model_name='ward',
32+
name='created_at',
33+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 774777, tzinfo=utc)),
34+
),
35+
]

arike/patients/forms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class Meta:
4242
"education",
4343
"occupation",
4444
"remarks",
45-
"patient",
4645
]
4746

4847

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Generated by Django 3.2.12 on 2022-03-12 13:42
2+
3+
import datetime
4+
from django.db import migrations, models
5+
from django.utils.timezone import utc
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('patients', '0015_auto_20220304_2237'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='disease',
17+
name='created_at',
18+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 778296, tzinfo=utc)),
19+
),
20+
migrations.AlterField(
21+
model_name='familymember',
22+
name='created_at',
23+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 777857, tzinfo=utc)),
24+
),
25+
migrations.AlterField(
26+
model_name='patient',
27+
name='created_at',
28+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 777382, tzinfo=utc)),
29+
),
30+
migrations.AlterField(
31+
model_name='patientdisease',
32+
name='created_at',
33+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 778569, tzinfo=utc)),
34+
),
35+
migrations.AlterField(
36+
model_name='treatment',
37+
name='created_at',
38+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 778881, tzinfo=utc)),
39+
),
40+
]

arike/patients/urls.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
path("<pk>/delete/", view=PatientDeleteView.as_view(), name="delete"),
3232
path("<pk>/family/", view=FamilyListVeiw.as_view(), name="family"),
3333
path("<pk>/family/add/", view=MemberCreateView.as_view(), name="family_add"),
34-
path("<pk>/family/<id>/", view=MemberUpdateView.as_view(), name="family_update"),
34+
path(
35+
"<pk>/family/<id>/update", view=MemberUpdateView.as_view(), name="family_update"
36+
),
3537
path("<pk>/family/del/<id>/", view=MemberDeleteView.as_view(), name="family_del"),
3638
path("<pk>/disease/", view=DiseaseListVeiw.as_view(), name="disease"),
3739
path("<pk>/disease/add/", view=DiseaseCreateView.as_view(), name="disease_add"),

arike/patients/views.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414
from arike.patients.models import FamilyMember, Patient, PatientDisease, Treatment
1515
from arike.facilities.models import Ward
16-
from arike.visits.models import TreatmentNote, VisitDetails, VisitSchedule
16+
from arike.visits.models import TreatmentNote, VisitDetails
1717
from arike.users.models import UserRoles
1818

1919

@@ -70,12 +70,17 @@ class GenericFamilyMemberFormView(NurseAuthMixin):
7070
slug_url_kwarg = "id"
7171

7272
def get_queryset(self):
73-
patient_pk = self.kwargs["pk"]
74-
return FamilyMember.objects.filter(patient__pk=patient_pk, deleted=False)
73+
return FamilyMember.objects.all()
7574

7675
def get_success_url(self):
7776
return reverse_lazy("patients:family", kwargs={"pk": self.kwargs["pk"]})
7877

78+
def form_valid(self, form):
79+
self.object = form.save(commit=False)
80+
self.object.patient = Patient.objects.get(pk=self.kwargs["pk"])
81+
self.object.save()
82+
return HttpResponseRedirect(self.get_success_url())
83+
7984

8085
class MemberCreateView(GenericFamilyMemberFormView, CreateView):
8186
pass
@@ -96,8 +101,7 @@ class GenericDiseaseFormView(NurseAuthMixin):
96101
slug_url_kwarg = "id"
97102

98103
def get_queryset(self):
99-
patient_pk = self.kwargs["pk"]
100-
return PatientDisease.objects.filter(patient__pk=patient_pk)
104+
return PatientDisease.objects.all()
101105

102106
def get_success_url(self):
103107
return reverse_lazy("patients:disease", kwargs={"pk": self.kwargs["pk"]})
@@ -128,8 +132,7 @@ class GenericTreatmentFormView(NurseAuthMixin):
128132
slug_url_kwarg = "id"
129133

130134
def get_queryset(self):
131-
patient_pk = self.kwargs["pk"]
132-
return Treatment.objects.filter(patient__pk=patient_pk)
135+
return Treatment.objects.all()
133136

134137
def get_success_url(self):
135138
return reverse_lazy("patients:treatments", kwargs={"pk": self.kwargs["pk"]})
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 3.2.12 on 2022-03-12 13:42
2+
3+
import datetime
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('users', '0014_alter_user_email_preff_time'),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name='user',
16+
name='email_last_sent',
17+
field=models.DateField(default=datetime.date(2022, 3, 12)),
18+
),
19+
migrations.AlterField(
20+
model_name='user',
21+
name='email_preff_time',
22+
field=models.TimeField(default=datetime.time(13, 42, 45, 775599)),
23+
),
24+
]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 3.2.12 on 2022-03-12 13:42
2+
3+
import datetime
4+
from django.db import migrations, models
5+
from django.utils.timezone import utc
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('visits', '0006_auto_20220304_2237'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='treatmentnote',
17+
name='created_at',
18+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 780550, tzinfo=utc)),
19+
),
20+
migrations.AlterField(
21+
model_name='visitdetails',
22+
name='created_at',
23+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 780052, tzinfo=utc)),
24+
),
25+
migrations.AlterField(
26+
model_name='visitschedule',
27+
name='created_at',
28+
field=models.DateTimeField(default=datetime.datetime(2022, 3, 12, 13, 42, 45, 779619, tzinfo=utc)),
29+
),
30+
]

arike/visits/views.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TreatmentsListVeiw(NurseAuthMixin, ListView):
8989
def get_queryset(self):
9090
schedule = VisitSchedule.objects.get(pk=self.kwargs["pk"])
9191
patient = schedule.patient
92-
treatments = Treatment.objects.filter(patient=patient)
92+
treatments = Treatment.objects.filter(patient=patient, deleted=False)
9393
return treatments
9494

9595
def get_context_data(self, **kwargs):
@@ -106,7 +106,9 @@ class GenericTreatmenNotetFormView(NurseAuthMixin):
106106

107107
def get_queryset(self):
108108
schedule = VisitSchedule.objects.get(pk=self.kwargs["pk"])
109-
return TreatmentNote.objects.filter(treatment__patient=schedule.patient)
109+
return TreatmentNote.objects.filter(
110+
treatment__patient=schedule.patient, deleted=False
111+
)
110112

111113
def get_success_url(self):
112114
return reverse_lazy("visits:treatments", kwargs={"pk": self.kwargs["pk"]})

0 commit comments

Comments
 (0)