wbcore 1.59.11__py2.py3-none-any.whl → 1.59.12__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,6 +36,7 @@ from .entries import (
36
36
  EntryRepresentationSerializer,
37
37
  InternalUserProfileRepresentationSerializer,
38
38
  PersonRepresentationSerializer,
39
+ FullDetailPersonRepresentationSerializer,
39
40
  SpecializationModelSerializer,
40
41
  SpecializationRepresentationSerializer,
41
42
  )
@@ -16,6 +16,7 @@ from ..models import (
16
16
  CompanyType,
17
17
  CustomerStatus,
18
18
  EmailContact,
19
+ EmployerEmployeeRelationship,
19
20
  Entry,
20
21
  Person,
21
22
  Specialization,
@@ -63,6 +64,54 @@ class PersonRepresentationSerializer(EntryRepresentationSerializer):
63
64
  )
64
65
 
65
66
 
67
+ class FullDetailPersonRepresentationSerializer(PersonRepresentationSerializer):
68
+ primary_email = wb_serializers.SerializerMethodField(
69
+ read_only=True, required=False, label=_("Primary Email"), allow_null=True
70
+ )
71
+ primary_telephone = wb_serializers.SerializerMethodField(
72
+ read_only=True, required=False, label=_("Primary Telephone"), allow_null=True
73
+ )
74
+ primary_position = wb_serializers.SerializerMethodField(
75
+ read_only=True, required=False, label=_("Primary Position"), allow_null=True
76
+ )
77
+
78
+ def get_primary_email(self, person):
79
+ try:
80
+ return EmailContact.objects.get(entry_id=person.id, primary=True).address
81
+ except EmailContact.DoesNotExist:
82
+ return None
83
+
84
+ def get_primary_telephone(self, person):
85
+ try:
86
+ return TelephoneContact.objects.get(entry_id=person.id, primary=True).number
87
+ except TelephoneContact.DoesNotExist:
88
+ return None
89
+
90
+ def get_primary_position(self, person):
91
+ try:
92
+ rel = EmployerEmployeeRelationship.objects.get(employee_id=person.id, primary=True)
93
+ return rel.position.title if rel.position else rel.position_name
94
+ except EmployerEmployeeRelationship.DoesNotExist:
95
+ return None
96
+
97
+ class Meta:
98
+ model = Person
99
+ fields = (
100
+ "id",
101
+ "computed_str",
102
+ "first_name",
103
+ "last_name",
104
+ "primary_email",
105
+ "primary_telephone",
106
+ "primary_position",
107
+ "profile_image",
108
+ "description",
109
+ "_detail",
110
+ "_detail_preview",
111
+ "_additional_resources",
112
+ )
113
+
114
+
66
115
  class InternalUserProfileRepresentationSerializer(PersonRepresentationSerializer):
67
116
  def get_filter_params(self, request):
68
117
  return {"only_internal_users": True}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbcore
3
- Version: 1.59.11
3
+ Version: 1.59.12
4
4
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
5
5
  Requires-Dist: celery[redis]==5.*
6
6
  Requires-Dist: croniter==2.*
@@ -328,10 +328,10 @@ wbcore/contrib/directory/models/relationships.py,sha256=7SZFo1tA7NRzS7_gv_fKwMsP
328
328
  wbcore/contrib/directory/release_notes/1_0_0.md,sha256=Twbl9RMLO6dbbm5dVoKorw8BecRqAYsKeobcNmDWHu8,165
329
329
  wbcore/contrib/directory/release_notes/1_0_1.md,sha256=yHolV-HwBmIavaPn9pg0ABRgxQ-eKIuiAs-phKb_ix0,285
330
330
  wbcore/contrib/directory/release_notes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
331
- wbcore/contrib/directory/serializers/__init__.py,sha256=36WcX6aHrBuZXVWR0JSCeCCvJin_jOEaiwuSYBSs5eo,2131
331
+ wbcore/contrib/directory/serializers/__init__.py,sha256=kLr-KkhQ3sd0rSE0vRWP6Za31KWoMrTiebpYKGhkdmY,2177
332
332
  wbcore/contrib/directory/serializers/companies.py,sha256=Bvxex_tq5lyR3k9Ox_Z2AnRQVyhPM0l1bdClJAjeEdo,5747
333
333
  wbcore/contrib/directory/serializers/contacts.py,sha256=Q-3lmivmS4ci9XP-65lO1d06Gm6cQMgPH3YA8FY71ZE,15205
334
- wbcore/contrib/directory/serializers/entries.py,sha256=QV_hlstwFWvhp-uiVPn3xMt0bES_6gKJs4rf_CVHIn0,13584
334
+ wbcore/contrib/directory/serializers/entries.py,sha256=FtHuXwKNrKigyx9w3T-r9RiD2XINmuEi-ru5_5WpHlU,15297
335
335
  wbcore/contrib/directory/serializers/entry_representations.py,sha256=Pj8j4HYDINvXlLZ7onBypF2ZOK_GGzFZevd-yzESqoU,1397
336
336
  wbcore/contrib/directory/serializers/persons.py,sha256=YtUgKKeijvV87JLtgeQtxmyk21COLQjSrb5klBw_EXQ,7641
337
337
  wbcore/contrib/directory/serializers/relationships.py,sha256=jGrjy8M8kaxNRHHJ0HiDMdD_-wZFwioRJabCpCwHZ4U,12390
@@ -1238,6 +1238,6 @@ wbcore/viewsets/generics.py,sha256=lKDq9UY_Tyc56u1bqaIEvHGgoaXwXxpZ1c3fLVteptI,1
1238
1238
  wbcore/viewsets/mixins.py,sha256=IdHd_uixOv3ExKoHxTgL5Bt8OELIwfYwhBZm0nsvZfc,12054
1239
1239
  wbcore/viewsets/utils.py,sha256=4520Ij3ASM8lOa8QZkCqbBfOexVRiZu688eW-PGqMOA,882
1240
1240
  wbcore/viewsets/viewsets.py,sha256=FPPESunEjlunDr5VFsjTfsquTS3iDSQkw0H6QjMKPqk,6574
1241
- wbcore-1.59.11.dist-info/METADATA,sha256=BDSGN09DBIVVwXIZpQGQB-A7noYzZtdRjPR04DxdhiA,2317
1242
- wbcore-1.59.11.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
1243
- wbcore-1.59.11.dist-info/RECORD,,
1241
+ wbcore-1.59.12.dist-info/METADATA,sha256=3P0NTHFMvLQkaopsmazWN789ZtepkAcEg0YxUTgnW-A,2317
1242
+ wbcore-1.59.12.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
1243
+ wbcore-1.59.12.dist-info/RECORD,,