Code

Opened 5 years ago

Closed 4 years ago

Last modified 3 years ago

#9784 closed (fixed)

Django admin: prepopulated_fields does not update on javascript (calendar) change

Reported by: x00nix@… Owned by: dgouldin
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: dgouldin@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I have prepopulated_fields = {'slug':('publication_date',) }, where publication_date is models.DateField.

In admin when I change date via javascript calendar, slug field is not updated. If I change it directly, slug field is updated correctly.

Attachments (2)

9784.diff (8.7 KB) - added by dgouldin 5 years ago.
9784.2.diff (6.0 KB) - added by dgouldin 5 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by dgouldin

  • Cc dgouldin@… added
  • Has patch set

comment:3 Changed 5 years ago by jacob

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 5 years ago by dgouldin

  • Owner changed from nobody to dgouldin
  • Patch needs improvement set

Need to add support for prepopulated field based on DateTime and hook events on "Today" and "Now" shortcuts.

comment:5 Changed 5 years ago by jacob

  • Triage Stage changed from Ready for checkin to Accepted

Kick back to accepted.

Changed 5 years ago by dgouldin

comment:6 Changed 5 years ago by dgouldin

  • Patch needs improvement unset

Added prepopulate support for MultiWidgets and hooked events for date and time shortcuts.

comment:7 Changed 5 years ago by dgouldin

  • Patch needs improvement set

Revising my approach ...

Changed 5 years ago by dgouldin

comment:8 Changed 5 years ago by dgouldin

  • Patch needs improvement unset

comment:9 Changed 5 years ago by jacob

  • milestone changed from 1.1 to 1.2

Pushing to 1.2: this is an annoying bug, but it's UI only and has an easy workaround of writing the slug by hand.

comment:10 Changed 4 years ago by ubernostrum

  • milestone changed from 1.2 to 1.3

I'm going to bump this off the 1.2 milestone, for a couple reasons:

  1. There are several tickets (this one, #9110, #9264 and #9983) all exposing cases where the event handling for prepopulated_fields falls over in specific edge cases, so the real solution is not to fix any of these individually but rather to make prepopulate_from more robust.
  2. I suspect the admin-ui work will be coming up for discussion in the 1.3 timeframe, and that's a more solid place to talk about dealing with this.

comment:11 Changed 4 years ago by lukeplant

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

(In [12937]) Fixed #13068, #9264, #9983, #9784 - regression with pre-populated fields and javascript inlines, and related bugs.

Thanks to hejsan for the report, and to Sean Brant and Carl Meyer for the patch.

#13068 is a regression caused by the new javascript inline forms in the
admin. The others were existing javascript bugs with prepopulated fields.
Since the solution depends on jQuery and would likely be very hard to
backport without it, it will not be backported to 1.1.X.

comment:12 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.