So, I'm trying to access the variable store in get_queryset() from get_context_data(). I though I can deal with that by using a global variable. But it didn't work too. Is there any other way to do that?
class StoreDetailView(ListView):
def get_queryset(self):
print(store) # an error happens
...
def get_context_data(self, **kwargs):
context = super(StoreDetailView, self).get_context_data(**kwargs)
context['store'] = Store.objects.filter(domainKey=self.kwargs['store_domainKey'])
context['store'] = get_object_or_404(Store, domainKey=self.kwargs['store_domainKey'])
store = context['store']
...
get_context_data, and needs to be done inget_queryset()to use pagination.self.kwargs['store_domainKey']in get_queryset,, no need to do it in context_Dataget_querysetshould handle thequerysetat all,get_context_datais only to send more data to templates viacontext