On Mar 31, 2006, at 1:30 PM, Alan Bailey wrote:
> I don't see any documentation on helper methods for the django  
> objects.

Most of this is actually already possible; specific instructions are  
below...

> By helper methods I'm envisioning the following:
>
> IsModified()

This could be useful, but it's probably not worth doing since Django  
would have to keep two copies of all your data in memory to figure  
this out.  Doubling the memory footprint of Django isn't on my wish- 
list :)

> - If an object is from the database and a field has been edited.
>
> IsNew()

This is already possible: if obj.id is None then the object hasn't  
been saved yet.

> GetAllFields()

Use obj._meta.fields

> GetAllEditableFields()

[f for f in obj._meta.fields if f.editable]

> GetAllCoreFields()

[f for f in obj._meta.fields if f.core] -- but core is going away  
soon, anyway.

Hope that helps,

Jacob

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to