Skip to content

Commit

Permalink
Merge pull request #7 from Arisophy/Develop
Browse files Browse the repository at this point in the history
Bug Fix : Object reference problem
  • Loading branch information
Arisophy authored Jan 6, 2021
2 parents 9ed3c44 + 53d1f71 commit 68c8dfb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DjangoSearchView/searchview/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def get(self, request, *args, **kwargs):
""" First Page """
form = self.get_form()
self.cleaned_data = form.get_initial_data()
request.session['_cleaned_data'] = self.cleaned_data
request.session['_cleaned_data'] = self.cleaned_data.copy()
if not self.first_display_all_list:
self.cleaned_data['pk'] = None
return super().get(request, *args, **kwargs)
Expand All @@ -34,7 +34,7 @@ def post(self, request, *args, **kwargs):
self.cleaned_data = form.cleaned_data
new = self.cleaned_data
old = request.session['_cleaned_data']
if all(old[key] == new[key] for key in old):
if all(new[key] == old.get(key) for key in new):
page = self.kwargs.get(page_kwarg) or self.request.POST.get(page_kwarg) or 1
self.kwargs[page_kwarg] = page
else:
Expand All @@ -43,7 +43,7 @@ def post(self, request, *args, **kwargs):
self.cleaned_data = {}
self.cleaned_data['pk'] = None
kwargs['form'] = form
request.session['_cleaned_data'] = self.cleaned_data
request.session['_cleaned_data'] = self.cleaned_data.copy()
return super().get(request, *args, **kwargs)

def get_queryset(self):
Expand Down

0 comments on commit 68c8dfb

Please sign in to comment.