Opened 12 years ago

Closed 12 years ago

#20208 closed Bug (invalid)

Type of id.value of inlineformset differs from creation

Reported by: roehner@… Owned by: nobody
Component: Forms Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

If i instantiate an inlineformset with request.POST, the type of the id of all fields will be unicode. If i instantiate it only with instance=object, the id is a long int. It should be a long int in both cases. The type is relevant, if accessing the id in a template (e.g. if the id references entries in a dictionary) and the different type causes problems there.

I guess, that this is the case not only with inlineformsets.

I use django 1.4.5

Change History (1)

comment:1 by Russell Keith-Magee, 12 years ago

Resolution: invalid
Status: newclosed

When you say "The type of the ID", where are you referring to? The ID on the instance held by the individual rows of the formset?

If this is the case, then this is an unfortunate case of "by design". but for historical reasons, the inputs to model constructors were allowed to be strings, and the conversion to native Python types is performed when it hits the database. I completely agree that it's not the best design, but it's very difficult to change this without altering some very fundamental behavior in Django, which could potentially break a lot of sites out there.

So - closing invalid. If I've misunderstood what you're reporting, please reopen with more details.

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