Don't show Save Defaults button if no user is logged in.
This commit is contained in:
parent
75c9f9ebc0
commit
e688471732
|
@ -231,6 +231,8 @@ class Grid(object):
|
|||
"""
|
||||
Check to see if the current user has default settings on file for this grid.
|
||||
"""
|
||||
if not self.request.user:
|
||||
return False
|
||||
# User defaults should have all or nothing, so just check one key.
|
||||
key = 'tailbone.{0}.grid.{1}.sortkey'.format(self.request.user.uuid, self.key)
|
||||
return get_setting(Session(), key) is not None
|
||||
|
@ -517,6 +519,7 @@ class Grid(object):
|
|||
|
||||
form = filters.GridFiltersForm(self.request, self.filters, defaults=data)
|
||||
|
||||
kwargs['request'] = self.request
|
||||
kwargs['grid'] = self
|
||||
kwargs['form'] = filters.GridFiltersFormRenderer(form)
|
||||
return render(template, kwargs)
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
</select>
|
||||
${form.tag('button', type='button', id='default-filters', c="Default Filters")}
|
||||
${form.tag('button', type='button', id='clear-filters', c="Clear Filters")}
|
||||
% if request.user:
|
||||
${form.tag('button', type='button', id='save-defaults', c="Save Defaults")}
|
||||
% endif
|
||||
</div>
|
||||
|
||||
${form.end()}
|
||||
|
|
Loading…
Reference in a new issue