Opened 9 years ago

Closed 8 years ago

#1799 closed enhancement (wontfix)

Replace dots by dashes or hyphens from form fields id's of related objects

Reported by: David Elias Owned by: nobody
Component: Forms Version:
Severity: trivial Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Dots in html id's gives an error in CSS when trying to assign styles.

maybe this will do:

def get_id(self):
    "Returns the HTML 'id' attribute for this form field."
    return FORM_FIELD_ID_PREFIX + self.field_name.replace('.', '_')

Attachments (1)

oldforms-id-replace-dots-by-underscore.diff (481 bytes) - added by david@… 9 years ago.
while newforms are under development here is a patch :)

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by david@…

while newforms are under development here is a patch :)

comment:1 Changed 8 years ago by Gary Wilson <gary.wilson@…>

  • Has patch set
  • Triage Stage changed from Unreviewed to Design decision needed

Not sure it would be worth committing changes to oldforms at this point in time. Is this an issue in newforms too?

comment:2 Changed 8 years ago by mtredinnick

  • Component changed from Admin interface to django.newforms
  • Triage Stage changed from Design decision needed to Accepted

Should be fixed, but only in newforms.

comment:3 Changed 8 years ago by anonymous

All right - i will test with newforms.

comment:4 Changed 8 years ago by chrj

I'm having some trouble decoding the ticket title "...form fields id's of related objects". Using the normal recipe for creating a newform, fields are created as properties and thus does can not contain dots (syntactically incorrect).

However if you manually alter the fields / base_fields properties of the form, you could make a field with a dot in the name.

Is it Django's problem, if you manually tries to break things?

comment:5 Changed 8 years ago by durdinator

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

Not an issue with newforms; wont fix oldforms.

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