[Django]-Django repeatable field with only new items

2👍

You have things a bit backwards. The ForeignKey relationship should be the other way around (since an instruction can have many steps, but each step only has one related instruction…a Many-to-One relationship).

class Step(models.Model):
    description = models.CharField(max_length=255)
    instruction = models.ForeignKey(Instruction, related_name='steps')

class Instruction(models.Model):
    # some fields

Now, in your Admin, you can use inlines to display these fields in a “repeatable” manner, similar to ACF.

Leave a comment