Skip to content

Commit

Permalink
Serializers for CRS mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Justus446 committed Jun 19, 2024
1 parent d898306 commit e3ed880
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions cpovc_mobile/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework import serializers

from cpovc_forms.models import OVCCaseRecord, OVCCaseCategory
from cpovc_mobile.models import OVCBasicCRSMobile, OVCBasicCategoryMobile, OVCBasicPersonMobile
from cpovc_registry.models import RegPerson, RegPersonsGuardians, RegPersonsSiblings


Expand Down Expand Up @@ -70,3 +71,34 @@ def get_case_categories(self, obj):
is_void=False, case_id_id=obj.case_id)
return categories.values(
'case_category', 'date_of_event', 'place_of_event', 'case_nature')

class CRSSerializerMobile(serializers.ModelSerializer):
"""Case Serializer."""

class Meta:
model = OVCBasicCRSMobile
fields = ('case_id', 'case_serial', 'case_reporter',
'reporter_telephone', 'reporter_county',
'reporter_sub_county', 'reporter_ward',
'reporter_village', 'case_date', 'perpetrator',
'county', 'constituency', 'organization_unit',
'case_landmark', 'hh_economic_status', 'family_status',
'mental_condition', 'physical_condition', 'other_condition',
'risk_level', 'referral', 'summon', 'case_narration',
'account', 'case_params', 'longitude', 'latitude')


class CRSCategorySerializerMobile(serializers.ModelSerializer):
class Meta:
model = OVCBasicCategoryMobile
fields = ('category_id', 'case_category', 'case_sub_category',
'case_date_event', 'case_nature', 'case_place_of_event',
'case')


class CRSPersonserializerMobile(serializers.ModelSerializer):
class Meta:
model = OVCBasicPersonMobile
fields = ('person_id', 'relationship', 'person_type',
'first_name', 'surname', 'other_names',
'dob', 'sex', 'case')

0 comments on commit e3ed880

Please sign in to comment.