Created
June 6, 2014 13:59
-
-
Save gpg4/d8cf357df3b927cf13a2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@property | |
def _dict(self): | |
from django.db.models.query_utils import DeferredAttribute | |
exclude = [f.name for f in self._meta.fields if | |
isinstance(self.__class__.__dict__.get(f.attname), | |
DeferredAttribute)] | |
return model_to_dict(self, fields=[field.name for field in | |
self._meta.fields], exclude=exclude) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment