Add overrides for email profiles, settings views
to make feedback email config readonly
This commit is contained in:
parent
365d5847a4
commit
d812e5465a
|
@ -5,5 +5,5 @@ Email definitions
|
||||||
|
|
||||||
from __future__ import unicode_literals, absolute_import
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
# just tempmon emails for now
|
from rattail.emails import user_feedback
|
||||||
from rattail_tempmon.emails import tempmon_low_temp, tempmon_high_temp, tempmon_critical_temp, tempmon_error
|
from rattail_tempmon.emails import tempmon_low_temp, tempmon_high_temp, tempmon_critical_temp, tempmon_error
|
||||||
|
|
|
@ -33,14 +33,14 @@ def includeme(config):
|
||||||
config.include('tailbone.views.brands')
|
config.include('tailbone.views.brands')
|
||||||
config.include('tailbone.views.customers')
|
config.include('tailbone.views.customers')
|
||||||
config.include('tailbone.views.departments')
|
config.include('tailbone.views.departments')
|
||||||
config.include('tailbone.views.email')
|
config.include('rattail_demo.web.views.email')
|
||||||
config.include('tailbone.views.employees')
|
config.include('tailbone.views.employees')
|
||||||
config.include('tailbone.views.families')
|
config.include('tailbone.views.families')
|
||||||
config.include('rattail_demo.web.views.people')
|
config.include('rattail_demo.web.views.people')
|
||||||
config.include('tailbone.views.products')
|
config.include('tailbone.views.products')
|
||||||
config.include('tailbone.views.reportcodes')
|
config.include('tailbone.views.reportcodes')
|
||||||
config.include('tailbone.views.roles')
|
config.include('tailbone.views.roles')
|
||||||
config.include('tailbone.views.settings')
|
config.include('rattail_demo.web.views.settings')
|
||||||
config.include('tailbone.views.stores')
|
config.include('tailbone.views.stores')
|
||||||
config.include('tailbone.views.subdepartments')
|
config.include('tailbone.views.subdepartments')
|
||||||
config.include('rattail_demo.web.views.tempmon')
|
config.include('rattail_demo.web.views.tempmon')
|
||||||
|
|
25
rattail_demo/web/views/email.py
Normal file
25
rattail_demo/web/views/email.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Email views
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
|
from tailbone.views import email as base
|
||||||
|
|
||||||
|
|
||||||
|
class ProfilesView(base.ProfilesView):
|
||||||
|
"""
|
||||||
|
Prevent edit/delete for 'feedback' email config
|
||||||
|
"""
|
||||||
|
|
||||||
|
def editable_instance(self, profile):
|
||||||
|
return profile['key'] != 'user_feedback'
|
||||||
|
|
||||||
|
def deletable_instance(self, profile):
|
||||||
|
return profile['key'] != 'user_feedback'
|
||||||
|
|
||||||
|
|
||||||
|
def includeme(config):
|
||||||
|
ProfilesView.defaults(config)
|
||||||
|
base.EmailPreview.defaults(config)
|
27
rattail_demo/web/views/settings.py
Normal file
27
rattail_demo/web/views/settings.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Settings views
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import unicode_literals, absolute_import
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from tailbone.views import settings as base
|
||||||
|
|
||||||
|
|
||||||
|
class SettingsView(base.SettingsView):
|
||||||
|
"""
|
||||||
|
Prevent edit/delete for 'feedback' email settings
|
||||||
|
"""
|
||||||
|
feedback = re.compile(r'^rattail\.mail\.user_feedback\..*')
|
||||||
|
|
||||||
|
def editable_instance(self, setting):
|
||||||
|
return not bool(self.feedback.match(setting.name))
|
||||||
|
|
||||||
|
def deletable_instance(self, setting):
|
||||||
|
return not bool(self.feedback.match(setting.name))
|
||||||
|
|
||||||
|
|
||||||
|
def includeme(config):
|
||||||
|
SettingsView.defaults(config)
|
Loading…
Reference in a new issue