|
|
""" How the background url is computed:
- For a question: it depends on the related section (see below)
- For a section:
- if a section has a background, then we create the background URL using this section's ID
- if not, then we fallback on the survey background url """
base_bg_url = "/survey/%s/%s/get_background_image"
for question in self:
if question.is_page:
background_section_id = question.id if question.background_image else False
else:
background_section_id = question.page_id.id if question.page_id.background_image else False
if background_section_id:
question.background_image_url = base_bg_url % (
question.survey_id.access_token,
background_section_id
)
else:
question.background_image_url = question.survey_id.background_image_url
|
|