Please do not post images of code or templates. They can’t be quoted or referenced in responses. They’re also hard to read on a lot of devices.
Copy / paste your code into your message, surrounded by lines of three backtick - ` characters. This means you’ll have a line of ```, then your code (or template, or error message, etc), then another line of ```.
Now, to directly answer the question you asked, everything you need to know to do this is documented at Built-in template tags and filters | Django documentation | Django. If you are having a specific problem with some part of this, please identify where you are having an issue.
model
class Worker(models.Model):
name = models.CharField(max_length=255,verbose_name="Full Name")
address = models.CharField(max_length=500,verbose_name="Address")
sex = models.CharField(default =0,max_length=255,blank=True,null=True,choices=[('0','Male'),('1','Female'),('3','Other')],verbose_name="Sex")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
verbose_name = "WORKER"
verbose_name_plural = 'WORKER'
def __str__(self):
return self.name
class Workday(models.Model):
name = models.ForeignKey(Worker,on_delete=models.CASCADE,verbose_name="Nhân Viên ")
daywork = models.DateField()
paid_leave = models.BooleanField(default=False,null=True)
unpaid_leave = models.BooleanField(default=False,null=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
verbose_name = " TIMEKEEPING"
verbose_name_plural = ' TIMEKEEPING'
def __int__(self):
return self.name
I need documentation to do this. help me!
The documentation is in the link I provided in my previous reply.
If you are having a specific problem with some part of this, please identify where you are having an issue.
What does your view currently look like for this? What does your template look like so far?
Can your material solve my problem?
amused . The forum has only one answer from an old goat.
and you really should learn to start with RTFM.