Add runtime mobile flag for MasterView

will be false unless one of the mobile views are in effect...hopefully this is
a good idea
This commit is contained in:
Lance Edgar 2018-07-15 18:12:21 -05:00
parent d3e67ccbcd
commit eccce1cabb

View file

@ -96,6 +96,7 @@ class MasterView(View):
mobile_filterable = False mobile_filterable = False
mobile_executable = False mobile_executable = False
mobile = False
listing = False listing = False
creating = False creating = False
creates_multiple = False creates_multiple = False
@ -494,6 +495,7 @@ class MasterView(View):
""" """
Mobile "home" page for the data model Mobile "home" page for the data model
""" """
self.mobile = True
self.listing = True self.listing = True
grid = self.make_mobile_grid() grid = self.make_mobile_grid()
return self.render_to_response('index', {'grid': grid}, mobile=True) return self.render_to_response('index', {'grid': grid}, mobile=True)
@ -669,6 +671,7 @@ class MasterView(View):
""" """
Mobile view for creating a new primary object Mobile view for creating a new primary object
""" """
self.mobile = True
self.creating = True self.creating = True
form = self.make_mobile_form(self.get_model_class()) form = self.make_mobile_form(self.get_model_class())
if self.request.method == 'POST': if self.request.method == 'POST':
@ -992,6 +995,7 @@ class MasterView(View):
""" """
Mobile view for displaying a single object's details Mobile view for displaying a single object's details
""" """
self.mobile = True
self.viewing = True self.viewing = True
instance = self.get_instance() instance = self.get_instance()
form = self.make_mobile_form(instance) form = self.make_mobile_form(instance)
@ -1211,6 +1215,7 @@ class MasterView(View):
""" """
Mobile view for row items Mobile view for row items
""" """
self.mobile = True
self.viewing = True self.viewing = True
row = self.get_row_instance() row = self.get_row_instance()
parent = self.get_parent(row) parent = self.get_parent(row)
@ -2526,6 +2531,7 @@ class MasterView(View):
""" """
Mobile view for creating a new row object Mobile view for creating a new row object
""" """
self.mobile = True
self.creating = True self.creating = True
parent = self.get_instance() parent = self.get_instance()
instance_url = self.get_action_url('view', parent, mobile=True) instance_url = self.get_action_url('view', parent, mobile=True)
@ -2646,6 +2652,7 @@ class MasterView(View):
""" """
Mobile view for editing a row object Mobile view for editing a row object
""" """
self.mobile = True
self.editing = True self.editing = True
row = self.get_row_instance() row = self.get_row_instance()
instance_url = self.get_row_action_url('view', row, mobile=True) instance_url = self.get_row_action_url('view', row, mobile=True)