Better query param parsing

This commit is contained in:
Oliver Walters 2019-04-15 23:30:17 +10:00
parent 3d9a1acc2e
commit ca96c8e22b

View File

@ -94,7 +94,7 @@ class PartDetail(DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(PartDetail, self).get_context_data(**kwargs) context = super(PartDetail, self).get_context_data(**kwargs)
if str(self.request.GET.get('edit', None)): if self.request.GET.get('edit', '').lower() in ['true', 'yes', '1']:
context['editing_enabled'] = 1 context['editing_enabled'] = 1
else: else:
context['editing_enabled'] = 0 context['editing_enabled'] = 0