I am working on a Django project that has multiple users that need to be able to interact with each other, such as sending messages or charging one another. However I am unsure how exactly I am supported to do this. I have a few models like this one:
class Transaction(models.Model):
#sendingUser = OneToOneField()
#recievingUser = OneToOneField()
amount = models.DecimalField(max_digits=11, decimal_places=2)
time_stamp = models.DateTimeField(auto_now_add=True)
transaction_cleared = models.BooleanField(default=False, blank=False, null=False)
What I would like to do is have the sendingUser be bound to the user currently logged in and the receiving user be bound to a user that the logged in user specifies.
Does doing something like sendingUser = OneToOneField(User)
give me the user that is currently logged in? I believe that is what this tutorial is telling me to do, http://blog.robinpercy.com/2010/04/25/django-onetoonefields/, but am not totally sure. What do I put in #recievingUser = OneToOneField()
to access a user not currently logged in? I have been trying to find something in the Docs or on SO but I am not exactly sure what I should be searching. Any help would be greatly appreciated.