mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-17 04:59:37 -04:00
Use service model for the copy page
The view here is rebuilding a pseudo-service object. Now that service objects have templates it’s cleaner to use the actual service object. Requires a small change to the `templates_by_type` method so that it can filter by one or many template types (a user should be able to copy any template whose type is enabled for their service, and the service they’re copying from).
This commit is contained in:
@@ -81,9 +81,11 @@ class Service():
|
||||
]
|
||||
|
||||
def templates_by_type(self, template_type):
|
||||
if isinstance(template_type, str):
|
||||
template_type = [template_type]
|
||||
return [
|
||||
template for template in self.templates
|
||||
if template_type in {'all', template['template_type']}
|
||||
if set(template_type) & {'all', template['template_type']}
|
||||
]
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user