mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fix some unnecessary CRSF exemptions
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
<span>Asset with that ID does not exist!</span>
|
||||
</div>
|
||||
|
||||
<form id="asset-search-form" class="mb-3" method="POST">
|
||||
<form id="asset-search-form" class="mb-3" method="GET">
|
||||
<div class="form-group form-row">
|
||||
<h3>Audit Asset:</h3>
|
||||
<div class="input-group input-group-lg">
|
||||
|
||||
@@ -15,7 +15,6 @@ from PyRIGS.views import GenericListView, GenericDetailView, GenericUpdateView,
|
||||
from assets import forms, models
|
||||
|
||||
|
||||
@method_decorator(csrf_exempt, name='dispatch')
|
||||
class AssetList(LoginRequiredMixin, generic.ListView):
|
||||
model = models.Asset
|
||||
template_name = 'asset_list.html'
|
||||
@@ -28,9 +27,7 @@ class AssetList(LoginRequiredMixin, generic.ListView):
|
||||
return initial
|
||||
|
||||
def get_queryset(self):
|
||||
if self.request.method == 'POST':
|
||||
self.form = forms.AssetSearchForm(data=self.request.POST)
|
||||
elif self.request.method == 'GET' and len(self.request.GET) > 0:
|
||||
if self.request.method == 'GET' and len(self.request.GET) > 0:
|
||||
self.form = forms.AssetSearchForm(data=self.request.GET)
|
||||
else:
|
||||
self.form = forms.AssetSearchForm(data=self.get_initial())
|
||||
@@ -181,7 +178,7 @@ class AssetAuditList(AssetList):
|
||||
|
||||
# TODO Refresh this when the modal is submitted
|
||||
def get_queryset(self):
|
||||
self.form = forms.AssetSearchForm(data={})
|
||||
self.form = forms.AssetSearchForm(data=self.request.GET)
|
||||
return self.model.objects.filter(Q(last_audited_at__isnull=True))
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user