I would like to add a field to a Django object with the related database column. Just adding an attribute will work if a set the attribute after initializing the model, but as usual, I'm trying to get it to work the Django way.
class Stuff(models.Model):
id = fields.UUIDField(primary_key=True)
name = models.CharField(max_length=128)
enabled = models.BooleanField(default=False)
log_user = None
This will work without any problems.
stuff = Stuff()
stuff.log_user = current_user
This doesn't
stuff = Stuff(log_user=current_user)
TypeError: 'log_user' is an invalid keyword argument for this function
Is there any way to have the field behave the Django way?