1π
β
I think the class Shift
is not actually required. Since, itβs there just to give a shift a name, that can be done in class MachineryShift
also.
class Machinery(models.Model):
name = models.CharField(max_length=100)
code = models.CharField(max_length=30)
class MachineryShift(models.Model):
machinery = models.ForeignKey('Machinery')
shift = models.Charfield(max_length=50)
shift_start_time = models.TimeField()
shift_end_time = models.TimeField()
This way, you can add as many shifts as you want for a machinery. Each machinery will have its own set of shifts.
π€xyres
Source:stackexchange.com