Django User model, adding function
- by Hellnar
Hello,
I want to add a new function to the default User model of Django for retrieveing a related list of Model type.
Such Foo model:
class Foo(models.Model):
owner = models.ForeignKey(User, related_name="owner")
likes = models.ForeignKey(User, related_name="likes")
........
#at some view
user = request.user
foos= user.get_related_foo_models()
Hwo can this be achieved ?