Add placeholders to text fields in receipts #6587
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the ability to add placeholders on text (input and textarea) fields, which are then displayed to the user. It also adds a template for Certificates of Attendance.
This is done by adding a placeholders dict in the attributes of the field, like so:
And in the HTML, calling the
format_htmlfilter:{{ custom_fields.text | format_html( person='<em>{} {}</em>'.format(personal_data.first_name | escape, personal_data.last_name | escape), person_affiliation='<em>{}</em>'.format(personal_data.affiliation | escape), event='<em>{}</em>'.format(event.title | escape), date=date, venue='<em>{}</em>'.format((custom_fields.venue or event.venue_name) | escape) ) }}Resulting in this view when generating receipts:

The Certificate of Attendance looks like so:
