Skip to content

Instantly share code, notes, and snippets.

@jacobian
Created March 30, 2012 04:04
Show Gist options
  • Save jacobian/2246392 to your computer and use it in GitHub Desktop.
Save jacobian/2246392 to your computer and use it in GitHub Desktop.
class User(models.Model):
def __getattr__(self, attr):
for profile in self.profiles:
try:
return getattr(profile, attr)
except AttributeError:
continue
raise AttributeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment