Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions en/authentication_authorization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ def post_new(request):
[...]
```

Or if you have a class based view:

```python
from django.views import View
from django.utils.decorators import method_decorator

class MyView(View):

@method_decorator(login_required)
def get(self, request, *args, **kwargs):
[...]
```

That's it! Now try to access `http://127.0.0.1:8000/post/new/`. Notice the difference?

> If you just got the empty form, you are probably still logged in from the chapter on the admin-interface. Go to `http://127.0.0.1:8000/admin/logout/` to log out, then go to `http://127.0.0.1:8000/post/new` again.
Expand Down