Opened 7 years ago
Last modified 7 years ago
#29434 closed Cleanup/optimization
model_to_dict should work with prefix — at Version 1
Reported by: | Maxim Danilov | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | Normal | Keywords: | models, prefix |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
model_to_dict Returns a dict containing the data in instance
suitable for passing as a Form's initial
keyword argument.
i am agree with that.
but sometimes it can helped to generate it with prefix in keys.
Change History (1)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|---|
Type: | Uncategorized → Cleanup/optimization |
Note:
See TracTickets
for help on using tickets.
Can you describe your use case in a bit more detail? Is the idea that the function would accept a
prefix
argument and simply add that prefix to all keys in the resulting dictionary? I'm unsure why you couldn't do that outside of Django.model_to_dict()
is a private API and I don't see much argument for adding options that Django itself doesn't use.