I have a BaseModel that looks like this:
class BaseModel(models.Model):
updated_by = models.ForeignKey(UserTable???)
updated_at = models.DateTimeField(auto_now=True)
created_by = models.TextField(default=0)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
abstract = True
I want to automatically update the updated_by
and created_by
fields. But I’m not sure what to put as the target of the ForeignKey
. I’m using Django’s built in auth_user table, so I don’t have a model for that.
Also, I’m not clear how I would get the user, since I don’t have access to the request
object