Opened 7 years ago

Closed 7 years ago

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

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by sorl

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
                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 7 years ago by jacob

  • Description modified (diff)

(fix formatting)

comment:3 Changed 7 years ago by jacob

  • milestone changed from 1.0 maybe to 1.0

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

comment:4 Changed 7 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 7 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

Changed 7 years ago by julien

sorl's patch in a diff

comment:6 Changed 7 years ago by julien

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 7 years ago by julien

  • Has patch set

comment:8 Changed 7 years ago by brosner

  • Resolution set to fixed
  • Status changed from new to closed

(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 4 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

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