Opened 3 years ago
Last modified 3 years ago
#33357 closed Bug
SuccessMessageMixin doesn't work with LoginView — at Version 1
Reported by: | Cihat Ertem | Owned by: | Baptiste Mispelon |
---|---|---|---|
Component: | contrib.messages | Version: | 4.0 |
Severity: | Normal | Keywords: | LoginView, messages, SuccessMessageMixin |
Cc: | Baptiste Mispelon | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I have a problem with SuccessMessageMixin, LoginView
. There is no problem with CreateView
:
class CreateRoom(SuccessMessageMixin, CreateView): template_name = 'base/room_form.html' form_class = RoomForm success_url = reverse_lazy('home') success_message = 'Message'
I can capture and use 'Message' in template but with LoginView
class Login(SuccessMessageMixin, LoginView): template_name = 'registration/login.html' success_url = reverse_lazy('home') success_message = 'Message!!!'
I can not capture 'Message' with LoginView
.
Change History (1)
comment:1 by , 3 years ago
Cc: | added |
---|---|
Component: | contrib.messages → contrib.auth |
Description: | modified (diff) |
Owner: | changed from | to
Status: | new → assigned |
Summary: | LoginView combine SuccessMessageMixin failed! → SuccessMessageMixin doesn't work with LoginView |
Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.
Hi,
Thanks for reporting this issue. I've taken the liberty to edit your original report to remove information that I don't think is relevant, I hope that's ok.
The issue comes from the fact that
LoginView.form_valid()
doesn't callsuper()
:I can't find a documented reason why and changing it to this doesn't break any tests:
That change should fix the reported issue and seems straightforward enough.