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:
Chris Hill-Scott
2018-11-05 16:17:44 +00:00
parent 318f846630
commit 48b0d4194e
2 changed files with 6 additions and 3 deletions

View File

@@ -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))

View File

@@ -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']