0

My models.py

class Timing(models.Model):
    time = models.CharField(max_length=250)
    count = models.IntegerField(default=0) # max=20

class Ticket(models.Model):
    username = models.CharField(max_length=50)
    no = models.ForeignKey(Timing, on_delete=models.CASCADE)

Is there a way I can increment the value of count variable in class Timing by 1 whenever I use no variable to connect object of Timing class (whenever I use the ForeignKey variable)?

Heisenberg
  • 475
  • 8
  • 24

0 Answers0