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