Skip to content

Commit

Permalink
Merge pull request #20 from dzhuang/fix_template_override
Browse files Browse the repository at this point in the history
Fix upload_template and download_template override after widget initialization
  • Loading branch information
dzhuang authored May 12, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 610bb07 + 4d01a40 commit 584043b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions galleryfield/widgets.py
Original file line number Diff line number Diff line change
@@ -109,6 +109,22 @@ def __init__(
self.options = options and options.copy() or {}
self.options.setdefault("accepted_mime_types", ['image/*'])

@property
def upload_template(self):
return self._upload_template

@upload_template.setter
def upload_template(self, value):
self._upload_template = value

@property
def download_template(self):
return self._download_template

@download_template.setter
def download_template(self, value):
self._download_template = value

@property
def thumbnail_size(self):
return self._thumbnail_size
@@ -322,8 +338,8 @@ def render(self, name, value, attrs=None, renderer=None):
'thumbnail_size': str(self.thumbnail_size),
'prompt_alert_on_window_reload_if_changed':
conf.PROMPT_ALERT_ON_WINDOW_RELOAD_IF_CHANGED,
'upload_template': self._upload_template,
'download_template': self._download_template
'upload_template': self.upload_template,
'download_template': self.download_template
}

# Do not fill in empty value to hidden inputs

0 comments on commit 584043b

Please sign in to comment.