Opened 18 years ago

Closed 17 years ago

#3294 closed enhancement (fixed)

Add as_dict() method to models

Reported by: Jeff Bauer <jbauer@…> 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 Adrian Holovaty, 18 years ago

Summary: Model object as dict[design-q] Add as_dict() method to models

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."

comment:2 by Adrian Holovaty, 18 years ago

Summary: [design-q] Add as_dict() method to modelsAdd as_dict() method to models
Triage Stage: UnreviewedDesign decision needed

comment:3 by Chris Beaven, 17 years ago

Resolution: fixed
Status: newclosed

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

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