I am trying to call request.session.get('items', {})
from a custom util function util.py.
but in that file, request object is not accessible, I can pass the request object from views.py but i don't want to. is there any way to use request object inside the custom functions (not view/template).
I have tried to import from django.http import HttpRequest
but this class doesn't have any session variable. django beginner, any help is appreciated thanks.
util.py:
def processData(data=None):
## get items form session
items = request.session.get('items', {}) ## error name 'request' is not defined
# append with data
items.update(data)
return items