In Django webpage(page can view by all), need to allow only certain people to edit the webpage and other people can just view the webpage.
In Django-admin page's Users table,I've changed the certain users to "Can view" option and added certain users "Can edit" option. It is not working as per expected.
For reference: 
Getting this error,
POST "/admin/auth/user/4/change/ HTTP/1.1" 302
Actual result to be is
POST "/admin/auth/user/4/change/ HTTP/1.1" 200
And that change result needs to be changed successfully and reflect
views.py
from django.views.generic.edit import UpdateView
from myapp.models import Author
class AuthorUpdate(UpdateView):
model = Author
fields = ['name']
template_name_suffix = '_update_form'
app/author_update_form.html
{% if request.user.is_authenticated and request.user.is_admin %}
<form method="post">{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Update">
</form>
{% else %}
<p>Display data</p>
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With