Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#8433 closed (fixed)

auth add_view popup

Reported by: sorl Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Jacob)

add_view should probably be:

                if "_addanother" in request.POST:
                    request.user.message_set.create(message=msg)
                    return HttpResponseRedirect(request.path)
+                elif '_popup' in request.REQUEST:
+                    return self.response_add(request, new_user)
                else:     
                    request.user.message_set.create(message=msg + ' ' + ugettext("You may edit it again below."))
                    return HttpResponseRedirect('../%s/' % new_user.id)

Attachments (1)

8433.authpopup.diff (760 bytes) - added by Julien Phalip 8 years ago.
sorl's patch in a diff

Download all attachments as: .zip

Change History (10)

comment:1 Changed 8 years ago by sorl

                if "_addanother" in request.POST:
                    request.user.message_set.create(message=msg)
                    return HttpResponseRedirect(request.path)
+               elif '_popup' in request.REQUEST:
+                   return self.response_add(request, new_user)
                else:     
                    request.user.message_set.create(message=msg + ' ' + ugettext("You may edit it again below."))
                    return HttpResponseRedirect('../%s/' % new_user.id)

comment:2 Changed 8 years ago by Jacob

Description: modified (diff)

(fix formatting)

comment:3 Changed 8 years ago by Jacob

milestone: 1.0 maybe1.0

Please explain more about why it should do this -- I can't tell from the patch what the problem is.

comment:4 Changed 8 years ago by sorl

When FK to User in a model and you add a new user by clicking the green plus. If you don't check for popup you will be presented to editing the options for the user in the popup window, which doesn't look very good. The downside (which I think is ok since its a popup) is that you wont be presented to the options editing for the new user at all.

comment:5 Changed 8 years ago by Jacob

Triage Stage: UnreviewedAccepted

Changed 8 years ago by Julien Phalip

Attachment: 8433.authpopup.diff added

sorl's patch in a diff

comment:6 Changed 8 years ago by Julien Phalip

I can confirm this is an annoying bug (the new user is not added to the FK field in the admin interface after the popup is closed or after the user's details are saved). sorl's patch works, and I've attached a diff with it so it's easier to commit.

However, while the patch prevents the bug, you cannot edit the new user's details (first name, last name etc.). You'd need to edit those details separately at a later stage. A proper and long term solution would be to detect the popup in the change_view and treat the request as if it were an add, not a change.

comment:7 Changed 8 years ago by Julien Phalip

Has patch: set

comment:8 Changed 8 years ago by Brian Rosner

Resolution: fixed
Status: newclosed

(In [8776]) Fixed #8433 -- Deal with the add user popup on models that foreign key to User correctly. Thanks sorl for the report and fix.

comment:9 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top