Say I have a model with a foreign key to a Django Auth user:
class Something(models.Model):
user = models.ForeignKey(User, related_name='something')
I can then access this model through a RelatedManager:
u = User.objects.create_user('richardhenry', '[email protected]', 'password')
u.something.all()
My question is, if I create a SomethingManager
and define some methods on it:
class SomethingManager(models.Manager):
def do_something(self):
pass
Is it possible to get the original User object (as in, the variable u
) within the do_something()
method? (Through the related manager; passing it in via the method args isn't what I'm after.)