P
P
Poul002020-01-01 23:07:24
Django
Poul00, 2020-01-01 23:07:24

How to check in UpdateView if the post editor is the author of the post?

Django | How to check in UpdateView if the post editor is the author of the post? Can this be done via request? But I don't understand how to properly implement this check.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-01-02
@Poul00

override the post method or whatever you have - by adding something like:

if request.user == self.object.author:
    ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question