Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#8433 closed (fixed)

auth add_view popup

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

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 16 years ago.
sorl's patch in a diff

Download all attachments as: .zip

Change History (10)

comment:1 by sorl, 16 years ago

                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 by Jacob, 16 years ago

Description: modified (diff)

(fix formatting)

comment:3 by Jacob, 16 years ago

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 by sorl, 16 years ago

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 by Jacob, 16 years ago

Triage Stage: UnreviewedAccepted

by Julien Phalip, 16 years ago

Attachment: 8433.authpopup.diff added

sorl's patch in a diff

comment:6 by Julien Phalip, 16 years ago

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 by Julien Phalip, 16 years ago

Has patch: set

comment:8 by Brian Rosner, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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