Answer the question
In order to leave comments, you need to log in
Imported LoginRequiredMixin what is wrong?
I do differentiation of access rights to the site imported
from django.contrib.auth.mixins import LoginRequiredMixin
then added it to the classclass ArticleCreateView(LoginRequiredMixin, CustomSuccessMessageMixin, CreateView):
login_url = reverse_lazy('edit_page')
model = Articles
template_name = 'edit_page.html'
form_class = ArticleForm
success_url = reverse_lazy('edit_page')
success_msg = 'запись создана'
def get_context_data(self,**kwargs):
kwargs['list_articles'] = Articles.objects.all().order_by('-id')
return super().get_context_data(**kwargs)
After that, I should be transferred to the authorization window, but in my case I get an error without a code and swears on Page not available Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question