Here's a part of __init__.py file inside /askbot/models folder:
def user_update_avatar_type(self):
"""counts number of custom avatars
and if zero, sets avatar_type to False,
True otherwise. The method is called only if
avatar application is installed.
Saves the object.
"""
if 'avatar' in django_settings.INSTALLED_APPS:
if self.avatar_set.count() > 0:
self.avatar_type = 'a'
else:
self.avatar_type = _check_gravatar(self.gravatar)
else:
self.avatar_type = _check_gravatar(self.gravatar)
self.save()
As you can see, at some point it calls self.avatar_set.count(), which I believe should be a method either native in User's Class from /Django/Contrib/auth or added by a User.add_to_class method like many others in this __init__.py file
But I can't seem to find where this 'avatar_set' method is defined.
Thanks
This is a reverse relationship, which is automatically added by Django when you define a ForeignKey pointing at the model. See the queries documentation.