Opened 9 years ago

Closed 6 years ago

Last modified 5 years ago

#4509 closed Uncategorized (wontfix)

Allow prepopulated_fields for non-slug fields

Reported by: jfindlay@… Owned by: adrian
Component: contrib.admin Version: master
Severity: Normal Keywords: prepopulate_from
Cc: ledermann@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


suppose I have a model,

class Customer(Model):
  def __str__(self):
    return str(

  name = CharField(maxlength=35)

  street_address_1 = CharField(maxlength=35)
  street_address_2 = CharField(maxlength=35,blank=True)
  street_address_3 = CharField(maxlength=35,blank=True)
  street_city = CharField(maxlength=35)
  street_region = ForeignKey('Region',related_name='customer_street_region')
  street_postal = CharField(maxlength=9)

  mailing_address_1 = CharField(maxlength=35)
  mailing_address_2 = CharField(maxlength=35,blank=True)
  mailing_address_3 = CharField(maxlength=35,blank=True)
  mailing_city = CharField(maxlength=35)
  mailing_region = ForeignKey('Region',related_name='customer_mailing_region')
  mailing_postal = CharField(maxlength=9)

  phone = PhoneNumberField(blank=True,null=True)
  extension = SmallIntegerField(blank=True,null=True)
  fax = PhoneNumberField(blank=True,null=True)

It would be nice if the mailing_address fields could be prepopulated with data from their corresponding street_address fields.

Change History (6)

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from prepopulate_from for non-slug fields to Allow prepopulate_from for non-slug fields

Hmm... I'm not sure that this is really needed - you can always override save to fill in things like this. If you do think that this is necessary, please reopen this and raise this on django-developers.

comment:2 Changed 7 years ago by floledermann

  • Resolution wontfix deleted
  • Status changed from closed to reopened

I do not understand why this bug is closed - this is about autopopulating things pre-save via Javascript in the admin, not doing something on save. Doing this on save would force the user to save a form that is incomplete or even invalid (if the second field is required). This is about saving the user the need for typing in information twice - information that might be identical but may be different.

I provided some example code of how this could be done in #11432, a duplicate of this bug.

comment:3 Changed 7 years ago by floledermann

  • Cc ledermann@… added
  • Summary changed from Allow prepopulate_from for non-slug fields to Allow prepopulated_fields for non-slug fields

Changed title to reflect changes in architecture (there is no prepopulate_from anymore).

comment:4 Changed 7 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 6 years ago by subsume

  • Resolution set to wontfix
  • Status changed from reopened to closed

Alex said he wouldn't mind a wontfix so here it is.

There are so many other ways to solve this problem. You can attach your own media to the fields in question. You can change your use case and create a check-box instead of duplicating the fields in the form. Prepopulated_fields has a history of only working for slug-fields, so this ticket is invalid because it was never an advertised use of prepopulated_fields.

comment:6 Changed 5 years ago by aaugustin

  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset

#16226 is a duplicate.

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