How to write a Get_Context_method

16 views
Skip to first unread message

Ahmed Khairy

unread,
May 13, 2020, 5:30:46 PM5/13/20
to Django users
Hi,

I have the following context and I am trying to write it correctly in a function 

This is context data :

def post_view(request):
    qs= Post.objects.all()
    user= request.user

    context= {
        'qs':qs,
        'user':user,
    } 

I am trying to define it in a class PostListView(ListView):

I need help writing it correctly

Shyam Acharjya

unread,
May 14, 2020, 12:04:11 AM5/14/20
to django...@googlegroups.com
try this

--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e81a0fc9-f0ab-4f3b-b61d-827a67db0466%40googlegroups.com.
code.png
Reply all
Reply to author
Forward
0 new messages