Opened 17 years ago
Closed 14 years ago
#10295 closed New feature (needsinfo)
pk name attribute not provided in <object> tag
| Reported by: | Kausikram | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Serialization) | Version: | 1.0 |
| Severity: | Normal | Keywords: | pk name |
| Cc: | Triage Stage: | Design decision needed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
when django serializes an object it creates an object tag having the primary key value as an attribute pk="value" and then provides the other fields as its children. however it never mentions the name of the primary key anywhere. This turns to be disadvantageous when the primary key is not the default id field but something custom specified in the model.
Support by providing a name attribute for the object tag, similar to that provided for the fields tag would be much appreciated.
Attachments (3)
Change History (9)
by , 17 years ago
comment:1 by , 17 years ago
| Has patch: | set |
|---|
comment:2 by , 17 years ago
kausikram: Please provides a diff against the root of the tree, instead of multiple complete files.
comment:3 by , 17 years ago
| Has patch: | unset |
|---|
comment:4 by , 17 years ago
| Triage Stage: | Unreviewed → Design decision needed |
|---|
comment:5 by , 15 years ago
| Severity: | → Normal |
|---|---|
| Type: | → New feature |
by , 14 years ago
| Attachment: | 10295.patch added |
|---|
comment:6 by , 14 years ago
| Easy pickings: | unset |
|---|---|
| Resolution: | → needsinfo |
| Status: | new → closed |
| UI/UX: | unset |
I just uploaded a patch that reflects the changes, but I still don't understand entirely which problem you're trying to solve. I need more info to determine if this is actually the best solution.
You're saying:
This turns to be disadvantageous when the primary key is not the default id field but something custom specified in the model.
Could you elaborate on "disadvantageous"?
python.py file of serializer module