Skip to content

Commit ddf4f7b

Browse files
authored
Fix: Customized field label not loaded (#291)
1 parent 6cf116f commit ddf4f7b

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/pretalx/cfp/forms/cfp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import logging
2+
3+
logger = logging.getLogger(__name__)
4+
5+
16
class CfPFormMixin:
27
"""All forms used in the CfP step process should use this mixin.
38

src/pretalx/cfp/views/user.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ def token(self):
6363
@cached_property
6464
def profile_form(self):
6565
bind = is_form_bound(self.request, "profile")
66+
cfp_flow_config = self.request.event.cfp_flow.config
67+
try:
68+
# TODO: There may be a mismatch somewhere else between how the config was saved and how it is loaded.
69+
# We should use Pydantic model for saving and loading, to make sure the data is consistent.
70+
field_configuration = cfp_flow_config["steps"]["profile"]["fields"]
71+
except KeyError:
72+
field_configuration = None
6673
return SpeakerProfileForm(
6774
user=self.request.user,
6875
event=self.request.event,
6976
read_only=False,
7077
with_email=False,
71-
field_configuration=self.request.event.cfp_flow.config.get(
72-
"profile", {}
73-
).get("fields"),
78+
field_configuration=field_configuration,
7479
data=self.request.POST if bind else None,
7580
files=self.request.FILES if bind else None,
7681
)

src/pretalx/common/templates/common/avatar.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
</div>
2828
</div>
2929
<div class="avatar-form form-group row">
30-
<label class="col-md-3 col-form-label">{{ _('Profile picture source') }}</label>
30+
<label class="col-md-3 col-form-label">{{ form.avatar_source.field.label }}</label>
3131
<div class="col-md-9">
3232
{{ form.avatar_source.as_widget }}
3333
</div>
3434
</div>
3535
<div class="avatar-form form-group row">
36-
<label class="col-md-3 col-form-label">{{ _('Profile picture license') }}</label>
36+
<label class="col-md-3 col-form-label">{{ form.avatar_license.field.label }}</label>
3737
<div class="col-md-9">
3838
{{ form.avatar_license.as_widget }}
3939
</div>

src/pretalx/orga/views/cfp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,5 +816,6 @@ def post(self, request, *args, **kwargs):
816816
if "action" in data and data["action"] == "reset":
817817
flow.reset()
818818
else:
819+
logger.debug("Saving new CfP flow configuration: %s", data)
819820
flow.save_config(data)
820821
return JsonResponse({"success": True})

0 commit comments

Comments
 (0)