A
A
AlexandrBirukov2017-08-22 10:13:46
Django
AlexandrBirukov, 2017-08-22 10:13:46

How to restrict access to only your model instances?

Good afternoon. If the user is logged in on the site, then by changing the URL, he can view and edit other people's posts. How can a specific user restrict the rights to view, change, delete only their model instances?
Thanks in advance for your reply.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Belousov, 2017-08-22
@AlexandrBirukov

Need to check
if request.user == object.author

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question