Hello,
Let’s say I have a Table1 that contains 5 data,
class Table1(models.Model):
code = models.CharField(max_length=16,unique=True)
author_Up = models.CharField(max_length=16,default=User)
date_Up = models.DateTimeField(auto_now=True)
post_date = models.DateTimeField(default=timezone.now)
author = models.ForeignKey(User,on_delete=models.CASCADE)
def __str__(self):
return self.code
I am using formes.py as:
class Table1_F(forms.ModelForm):
code = forms.CharField(label='Code',max_length=16)
class Meta:
model= Table1
fields=['code']
The Problem is I need to assign a new values of (author_Up) and (date_Up) every time that another user make an update and keep the initial author.
How do I solve this Please?