Opened 18 years ago
Closed 17 years ago
#3294 closed enhancement (fixed)
Add as_dict() method to models
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | normal | Keywords: | |
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
I'd like to request an as_dict()
method to be added to Model. People are treating __dict__
as a way to access the model instance data, e.g.: http://tinyurl.com/ykxjgs
It would be better to have a public method so code won't break if __dict__
were to ever be used internally in ways the application developer didn't anticipate.
Change History (3)
comment:1 by , 18 years ago
Summary: | Model object as dict → [design-q] Add as_dict() method to models |
---|
comment:2 by , 18 years ago
Summary: | [design-q] Add as_dict() method to models → Add as_dict() method to models |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Newforms-admin adds an initial_data
method which handles this. I'll preemptively mark as fixed because it's not worth doing anything else in this ticket. See also #5126
I'm always hesitant to add methods to model instances. We'll have to give this some thought.
I'm putting
[design-q]
in the ticket summary to designate "a design decision needs to be made here."