lundi 28 octobre 2019

If statement exist in django class based view

I love class based views but I can't figure out how to write this in Cbv, this is fbv

is_like = False
if post.like.filter(id=request.user.id).exists ():
    is_like = True

While I tried in Cbv and I got all sorts of errors

Aucun commentaire:

Enregistrer un commentaire