Not found author now returns a 404 error.
This commit is contained in:
parent
c4d1466539
commit
c483662885
1 changed files with 2 additions and 1 deletions
|
@ -16,6 +16,7 @@ from parler.views import TranslatableSlugMixin, ViewUrlMixin
|
|||
|
||||
from .models import BlogCategory, Post
|
||||
from .settings import get_setting
|
||||
from django.shortcuts import get_object_or_404
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
@ -166,7 +167,7 @@ class AuthorEntriesView(BaseBlogListView, ListView):
|
|||
return self.optimize(qs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
kwargs['author'] = User.objects.get(**{User.USERNAME_FIELD: self.kwargs.get('username')})
|
||||
kwargs['author'] = get_object_or_404(User, **{User.USERNAME_FIELD: self.kwargs.get('username')})
|
||||
context = super(AuthorEntriesView, self).get_context_data(**kwargs)
|
||||
return context
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue