Hello guys,

I have a little question about request attribute in my function located in 
a menu.py file (not my view):

def list_of_edition(request):
    """ Return list of editions
    :return queryset
    """
    instance = NavbarMenuSettings.objects.filter(application=request.cur_app
, display=True).order_by('order')
    return instance

My request.cur_app is given by my middleware.py file:

class MultiSiteMiddleware:

    def __init__(self, get_response):
        self.get_response = get_response

    def __call__(self, request):
        request.cur_app = WebApplication.objects.get_current(request)
        return self.get_response(request)

I would like to call list_of_edition() but I get each time the same issue:

TypeError: list_of_edition() missing 1 required positional argument: 
'request'

I would like to now How I can handle my function in order to use it outside 
of views.py file ? 
I'm blocked since a moment and I don't find any way to do that.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/82e53fad-87fd-49fe-bf1d-08f3941551ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to