Opened 17 years ago

Closed 13 years ago

Last modified 13 years ago

#4509 closed Uncategorized (wontfix)

Allow prepopulated_fields for non-slug fields

Reported by: jfindlay@… Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
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

Description

suppose I have a model,

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

  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 by Simon G. <dev@…>, 17 years ago

Resolution: wontfix
Status: newclosed
Summary: prepopulate_from for non-slug fieldsAllow 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 by Flo Ledermann, 15 years ago

Resolution: wontfix
Status: closedreopened

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 by Flo Ledermann, 15 years ago

Cc: ledermann@… added
Summary: Allow prepopulate_from for non-slug fieldsAllow prepopulated_fields for non-slug fields

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

comment:4 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:5 by Yeago, 13 years ago

Resolution: wontfix
Status: reopenedclosed

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

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

#16226 is a duplicate.

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