-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
project_submission: handle case of an unassigned project.
On the submission page we display a contact address for the project editor, if one has been assigned. If no editor has yet been assigned, then the "contact_email" won't be shown. However, if no editor has yet been assigned (self.editor is None) and there is no PROJECT_EDITOR_EMAIL defined, the previous code would crash. Put this logic into the model class, not the view, and document it.
- Loading branch information
Benjamin Moody
committed
Jan 16, 2024
1 parent
323cdff
commit 28e995a
Showing
2 changed files
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,29 @@ def has_wfdb(self): | |
""" | ||
return self.files.has_wfdb_files(self) | ||
|
||
@property | ||
def editor_contact_email(self): | ||
""" | ||
Email address for contacting the project editor. | ||
If a site-wide contact address is configured, that address | ||
will be used for all projects. The string PROJECT-SLUG can be | ||
included and will be replaced by the active project slug (for | ||
example, PROJECT_EDITOR_EMAIL can be set to | ||
'[email protected]', if the mail server | ||
understands how to handle it.) | ||
If there is no site-wide contact address, the primary email | ||
address of the assigned editor is used. | ||
""" | ||
if not self.editor: | ||
return None | ||
elif settings.PROJECT_EDITOR_EMAIL: | ||
return settings.PROJECT_EDITOR_EMAIL.replace('PROJECT-SLUG', | ||
self.slug) | ||
else: | ||
return self.editor.email | ||
|
||
def content_modified(self): | ||
""" | ||
Update the project's modification timestamp. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters