Created
December 2, 2011 00:50
-
-
Save glenrobertson/1421081 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only show the fields specified in the json properties list of the model | |
if hasattr(item, 'json_properties'): | |
json_properties = getattr(item, 'json_properties') | |
properties = {} | |
for k,v in item.__dict__.iteritems(): | |
if k in json_properties: | |
properties[k] = v | |
# the json properties list is not available, so copy all the properites | |
else: | |
properties = item.__dict__.copy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment