wbcore 1.59.12__py2.py3-none-any.whl → 1.59.14__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.
@@ -11,16 +11,6 @@ from wbcore.metadata.configs.buttons.view_config import ButtonViewConfig
11
11
  class EntryModelButtonConfig(ButtonViewConfig):
12
12
  CRM_BUTTONS = ()
13
13
 
14
- CONTACT_BUTTONS = (
15
- bt.WidgetButton(key="relationships", label=gettext_lazy("Relationships"), icon=WBIcon.GROUPS.icon),
16
- bt.WidgetButton(key="emails", label=gettext_lazy("Emails"), icon=WBIcon.MAIL.icon),
17
- bt.WidgetButton(key="telephones", label=gettext_lazy("Telephones"), icon=WBIcon.PHONE.icon),
18
- bt.WidgetButton(key="addresses", label=gettext_lazy("Addresses"), icon=WBIcon.LOCATION.icon),
19
- bt.WidgetButton(key="websites", label=gettext_lazy("Websites"), icon=WBIcon.PUBLIC.icon),
20
- bt.WidgetButton(key="bankings", label=gettext_lazy("Bankings"), icon=WBIcon.BANK.icon),
21
- bt.WidgetButton(key="social_media", label=gettext_lazy("Social Media"), icon=WBIcon.NEWSPAPER.icon),
22
- )
23
-
24
14
  def get_custom_list_instance_buttons(self):
25
15
  return {
26
16
  bt.DropDownButton(
@@ -40,9 +30,6 @@ class EntryModelButtonConfig(ButtonViewConfig):
40
30
  return {
41
31
  bt.WidgetButton(key="employees", label=_("Employees"), icon=WBIcon.PEOPLE.icon, weight=2),
42
32
  bt.WidgetButton(key="manager", label=_("Relationship Managers"), icon=WBIcon.SUPERVISE.icon, weight=3),
43
- bt.DropDownButton(
44
- label=_("More Information"), icon=WBIcon.UNFOLD.icon, buttons=self.CONTACT_BUTTONS, weight=4
45
- ),
46
33
  }
47
34
 
48
35
 
@@ -58,9 +45,6 @@ class PersonModelButtonConfig(EntryModelButtonConfig):
58
45
  return {
59
46
  bt.WidgetButton(key="employers", label=_("Employers"), icon=WBIcon.WORK.icon, weight=2),
60
47
  bt.DropDownButton(label=_("Client/Manager"), icon=WBIcon.UNFOLD.icon, buttons=self.CRM_BUTTONS, weight=3),
61
- bt.DropDownButton(
62
- label=_("More Information"), icon=WBIcon.UNFOLD.icon, buttons=self.CONTACT_BUTTONS, weight=4
63
- ),
64
48
  }
65
49
 
66
50
 
@@ -21,6 +21,139 @@ class EntryModelDisplay(DisplayViewConfig):
21
21
  return create_simple_display([["computed_str"]])
22
22
 
23
23
 
24
+ # CONTACT_PAGE = Page(
25
+ # title=_("Contacts"),
26
+ # layouts={
27
+ # default(): Layout(
28
+ # grid_template_areas=[
29
+ # ["addresses_table", "addresses_table"],
30
+ # ["telephones_table", "emails_table"],
31
+ # ["websites_table", "social_media_table"],
32
+ # ["bankings_table", "bankings_table"],
33
+ # ["relationships_table", "relationships_table"],
34
+ # ],
35
+ # grid_auto_rows=Style.AUTO,
36
+ # grid_template_rows=[
37
+ # "200px",
38
+ # "200px",
39
+ # "200px",
40
+ # "200px",
41
+ # "200px",
42
+ # ],
43
+ # inlines=[
44
+ # Inline(
45
+ # key="addresses_table",
46
+ # endpoint="addresses",
47
+ # title="Addresses",
48
+ # ),
49
+ # Inline(
50
+ # key="telephones_table",
51
+ # endpoint="telephones",
52
+ # title="Telephones",
53
+ # ),
54
+ # Inline(
55
+ # key="emails_table",
56
+ # endpoint="emails",
57
+ # title="Emails",
58
+ # ),
59
+ # Inline(
60
+ # key="websites_table",
61
+ # endpoint="websites",
62
+ # title="Websites",
63
+ # ),
64
+ # Inline(
65
+ # key="bankings_table",
66
+ # endpoint="bankings",
67
+ # title="Banking",
68
+ # ),
69
+ # Inline(
70
+ # key="social_media_table",
71
+ # endpoint="social_media",
72
+ # title="Socials",
73
+ # ),
74
+ # Inline(
75
+ # key="relationships_table",
76
+ # endpoint="relationships",
77
+ # title="Relationships",
78
+ # ),
79
+ # ],
80
+ # ),
81
+ # },
82
+ # )
83
+ contact_section = Section(
84
+ key="contact_section",
85
+ collapsible=False,
86
+ title=_("Contacts"),
87
+ display=Display(
88
+ pages=[
89
+ Page(
90
+ title=_("Telephones"),
91
+ layouts={
92
+ default(): Layout(
93
+ grid_template_areas=[["telephone_table"]],
94
+ inlines=[Inline(key="telephone_table", endpoint="telephones")],
95
+ )
96
+ },
97
+ ),
98
+ Page(
99
+ title=_("Emails"),
100
+ layouts={
101
+ default(): Layout(
102
+ grid_template_areas=[["email_table"]],
103
+ inlines=[Inline(key="email_table", endpoint="emails")],
104
+ )
105
+ },
106
+ ),
107
+ Page(
108
+ title=_("Addresses"),
109
+ layouts={
110
+ default(): Layout(
111
+ grid_template_areas=[["addresses_table"]],
112
+ inlines=[Inline(key="addresses_table", endpoint="addresses")],
113
+ )
114
+ },
115
+ ),
116
+ Page(
117
+ title=_("Websites"),
118
+ layouts={
119
+ default(): Layout(
120
+ grid_template_areas=[["website_table"]],
121
+ inlines=[Inline(key="website_table", endpoint="websites")],
122
+ )
123
+ },
124
+ ),
125
+ Page(
126
+ title=_("Bankings"),
127
+ layouts={
128
+ default(): Layout(
129
+ grid_template_areas=[["banking_table"]],
130
+ inlines=[Inline(key="banking_table", endpoint="bankings")],
131
+ )
132
+ },
133
+ ),
134
+ Page(
135
+ title=_("Socials"),
136
+ layouts={
137
+ default(): Layout(
138
+ grid_template_areas=[["socials_table"]],
139
+ inlines=[Inline(key="socials_table", endpoint="social_media")],
140
+ )
141
+ },
142
+ ),
143
+ Page(
144
+ title=_("Relationships"),
145
+ layouts={
146
+ default(): Layout(
147
+ grid_template_areas=[["relationship_table"]],
148
+ inlines=[Inline(key="relationship_table", endpoint="relationships")],
149
+ )
150
+ },
151
+ ),
152
+ ]
153
+ ),
154
+ )
155
+
156
+
24
157
  class PersonModelDisplay(EntryModelDisplay):
25
158
  @classmethod
26
159
  def _get_person_instance_display(cls) -> Display:
@@ -66,7 +199,7 @@ class PersonModelDisplay(EntryModelDisplay):
66
199
  "personality_profile_blue",
67
200
  "activity_table",
68
201
  ],
69
- ["employers_section", "employers_section", "employers_section", "employers_section"],
202
+ ["employers_section", "employers_section", "employers_section", "contact_section"],
70
203
  ],
71
204
  grid_template_columns=[
72
205
  Style.MIN_CONTENT,
@@ -76,7 +209,7 @@ class PersonModelDisplay(EntryModelDisplay):
76
209
  ],
77
210
  grid_template_rows=[Style.rem(6), Style.rem(6), Style.rem(6), Style.rem(6)],
78
211
  grid_auto_rows=Style.MIN_CONTENT,
79
- sections=[employers_section],
212
+ sections=[employers_section, contact_section],
80
213
  inlines=[
81
214
  Inline(
82
215
  key="activity_table",
@@ -362,9 +495,9 @@ class CompanyModelDisplay(EntryModelDisplay):
362
495
  ["profile_image", "primary_telephone", "primary_telephone", "activity_table"],
363
496
  ["profile_image", "type", "tier", "activity_table"],
364
497
  ["profile_image", "activity_heat", "activity_heat", "activity_table"],
365
- ["employees_section", "employees_section", "employees_section", "employees_section"],
498
+ ["employees_section", "employees_section", "employees_section", "contact_section"],
366
499
  ]
367
- sections = [employees_section]
500
+ sections = [employees_section, contact_section]
368
501
  if portfolio_fields:
369
502
  grid_template_areas.insert(
370
503
  4,
@@ -377,7 +510,7 @@ class CompanyModelDisplay(EntryModelDisplay):
377
510
  )
378
511
  sections.append(portfolio_fields)
379
512
  if aum_table:
380
- grid_template_areas[-1][-1] = aum_table.key
513
+ grid_template_areas.append([aum_table.key, aum_table.key, aum_table.key, aum_table.key])
381
514
  sections.append(aum_table)
382
515
 
383
516
  return Display(
@@ -1,6 +1,7 @@
1
1
  from datetime import date, datetime, timedelta
2
2
 
3
3
  import pytz
4
+ from django.core.exceptions import ValidationError
4
5
  from psycopg.types.range import DateRange, TimestampRange, TimestamptzRange
5
6
  from rest_framework import serializers
6
7
  from rest_framework.settings import api_settings
@@ -36,9 +37,28 @@ class ShortcutMixin(WBCoreSerializerFieldMixin):
36
37
  return key, representation
37
38
 
38
39
 
40
+ class DateRangeBoundedValidator:
41
+ """
42
+ Ensure a psycopg DateRange has both lower and upper bounds set (no None).
43
+ """
44
+
45
+ def __call__(self, value):
46
+ # Accept empty values the usual DRF way; let `required` handle presence.
47
+ if value is None:
48
+ return
49
+
50
+ # DateRange / DateTimeTZRange objects expose .lower and .upper. [web:30][web:44]
51
+ lower = getattr(value, "lower", None)
52
+ upper = getattr(value, "upper", None)
53
+
54
+ if lower is None or upper is None:
55
+ raise ValidationError("This range must have both a lower and an upper bound.")
56
+
57
+
39
58
  class DateRangeField(RangeMixin, ShortcutMixin, serializers.DateField):
40
59
  field_type = WBCoreType.DATERANGE.value
41
60
  internal_field = DateRange
61
+ default_validators = [DateRangeBoundedValidator()]
42
62
 
43
63
  def __init__(
44
64
  self,
@@ -78,6 +98,7 @@ class DateRangeField(RangeMixin, ShortcutMixin, serializers.DateField):
78
98
  class DateTimeRangeField(RangeMixin, ShortcutMixin, serializers.DateTimeField):
79
99
  field_type = WBCoreType.DATETIMERANGE.value
80
100
  internal_field = TimestamptzRange
101
+ default_validators = [DateRangeBoundedValidator()]
81
102
 
82
103
  def __init__(self, *args, lower_time_choices=None, upper_time_choices=None, **kwargs):
83
104
  self.lower_time_choices = lower_time_choices
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wbcore
3
- Version: 1.59.12
3
+ Version: 1.59.14
4
4
  Author-email: Christopher Wittlinger <c.wittlinger@stainly.com>
5
5
  Requires-Dist: celery[redis]==5.*
6
6
  Requires-Dist: croniter==2.*
@@ -376,11 +376,11 @@ wbcore/contrib/directory/viewsets/relationships.py,sha256=jy73aCven25PbLoy3-KTjn
376
376
  wbcore/contrib/directory/viewsets/utils.py,sha256=2i7rIT8qMCD-ajT-uNN7Re4uMRwijrzvblokedJnwOw,3400
377
377
  wbcore/contrib/directory/viewsets/buttons/__init__.py,sha256=dB3nD_NflX6U5muEMwtBcm3aNB0w65h42iYmtbMbFb4,270
378
378
  wbcore/contrib/directory/viewsets/buttons/contacts.py,sha256=BECTH8ADx-Pz8kk11dpLGB2xRrkMI5emoIHcL8wdrJU,599
379
- wbcore/contrib/directory/viewsets/buttons/entries.py,sha256=X7tH209qPojFNlBiE8hU5BrxQHa07WkBddVtvX-aCds,5660
379
+ wbcore/contrib/directory/viewsets/buttons/entries.py,sha256=AH4M9L-XgJzDd2cEwk7xss8ksp6n1UGh03ESj_HWLmU,4613
380
380
  wbcore/contrib/directory/viewsets/buttons/relationships.py,sha256=Q1vLLA9ZGt-s29Of8dj24IlMQzDzW_sMPU7n_F00DuY,2786
381
381
  wbcore/contrib/directory/viewsets/display/__init__.py,sha256=NiC0d1-RjPIYEzkGAQzThNFQeYv5UAW3aKL9j_lFV38,945
382
382
  wbcore/contrib/directory/viewsets/display/contacts.py,sha256=2PBSxVmbq_26LyhSTWrpjNv9cxKz7w086BqoVX7SDs4,13449
383
- wbcore/contrib/directory/viewsets/display/entries.py,sha256=tK2tsiJvKy_SEWHq9TT30Nu1g158bpGv5z4EnFd9psQ,23548
383
+ wbcore/contrib/directory/viewsets/display/entries.py,sha256=puz_PqnHOYHvqeeu7Y-ggHsBcc5V1IdduxETAvMtBho,28068
384
384
  wbcore/contrib/directory/viewsets/display/relationships.py,sha256=-s3ABMIGmbvmAOe8CRJqVv8RpKaMw7xeoy0HSvo0kRQ,11587
385
385
  wbcore/contrib/directory/viewsets/display/utils.py,sha256=5sMFdEXUfanKp60IvTyO4YLqFlEUz9fGMldoqTYTnwU,830
386
386
  wbcore/contrib/directory/viewsets/endpoints/__init__.py,sha256=0z1LYIrLQvIcs2qZEfD2SYB6tqycmSQjlJ4NwZgd0JY,647
@@ -1106,7 +1106,7 @@ wbcore/serializers/utils.py,sha256=H_faApLg6bNiZvZNvApZhmVBJ07obw1u5QKZx7DLLa8,4
1106
1106
  wbcore/serializers/fields/__init__.py,sha256=xNNak0yl8FtC6m-__B5mfieSNGAygXND34E_HrJ2Fcw,1498
1107
1107
  wbcore/serializers/fields/boolean.py,sha256=vwP7HQflArFEG0w9FfXkPYKreFJ5qMjs-L0qKMeKCVQ,1682
1108
1108
  wbcore/serializers/fields/choice.py,sha256=ozVwKaPCpsgPuQXQWr8TxHIcxSdGvhw23OFVD0xnipg,2128
1109
- wbcore/serializers/fields/datetime.py,sha256=UVrBAdh-Iy3cDdVxbce9rsPYwwfxDJ-kJEr_1K_29ec,7386
1109
+ wbcore/serializers/fields/datetime.py,sha256=cHJNQyR5Xx9Z7AQEBpmRB7obRRwqAiMZeVzdPo0udts,8151
1110
1110
  wbcore/serializers/fields/fields.py,sha256=R_JJxnSfgKK6pYFgfe_-7qo_y25YksQ-WuNgiKWev4U,7068
1111
1111
  wbcore/serializers/fields/file.py,sha256=tDDK2bITiP7zxl9Ilzja2_gWae_lf9CkO1rDEBPaj6g,568
1112
1112
  wbcore/serializers/fields/fsm.py,sha256=xUYxDj166PDnmDLggI4fShXdSunJVzbc8quFQioM3Yc,700
@@ -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.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,,
1241
+ wbcore-1.59.14.dist-info/METADATA,sha256=TiTbuASllTZhi0LXNXfDDZCxJxj1ebOC3EOYvyEzWY0,2317
1242
+ wbcore-1.59.14.dist-info/WHEEL,sha256=aha0VrrYvgDJ3Xxl3db_g_MDIW-ZexDdrc_m-Hk8YY4,105
1243
+ wbcore-1.59.14.dist-info/RECORD,,