mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-26 18:32:15 -04:00
Use model to toggle research mode
Just a nice bit of encapsulation, rather than passing `current_service` through to a method on `current_service`.
This commit is contained in:
@@ -221,9 +221,7 @@ def service_switch_live(service_id):
|
||||
@login_required
|
||||
@user_is_platform_admin
|
||||
def service_switch_research_mode(service_id):
|
||||
current_service.update_with_properties(
|
||||
{'research_mode': not current_service.research_mode}
|
||||
)
|
||||
current_service.toggle_research_mode()
|
||||
return redirect(url_for('.service_settings', service_id=service_id))
|
||||
|
||||
|
||||
|
||||
@@ -78,6 +78,11 @@ class Service():
|
||||
|
||||
self.update_with_properties(data)
|
||||
|
||||
def toggle_research_mode(self):
|
||||
self.update_with_properties({
|
||||
'research_mode': not self.research_mode,
|
||||
})
|
||||
|
||||
@property
|
||||
def trial_mode(self):
|
||||
return self._dict['restricted']
|
||||
|
||||
Reference in New Issue
Block a user