Django - Creating a checklist form

Viewed 115

I've been working on a little side project for a while and I've gone into a deep hole. I'm hoping for some guidance from people who have been in the Django world longer than I.

Currently, I'm working on a simple maintenance form, where we have a Model Maintenance_Items (which holds just id, name and description). I have a second model, MaintenanceCheckList, that uses a ForeignKey from Maintenance_Item and has a BooleanField to mark an item as compliant that day. Note, I capture CreatedDate under my CommonInfo fields.

class Maintenance_Item(CommonInfo):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=100, unique=True)
    name_description = models.CharField(max_length=255)

class MaintenanceCheckList(CommonInfo):
    id = models.AutoField(primary_key=True)
    item = models.ForeignKey(Maintenance_Item, on_delete=models.CASCADE)
    is_compliant = models.BooleanField

I'm looking for a way to generate a form, and I was thinking Formsets would be the answer, where a Form is generated for each Item in Maintenance Item with the Item Name prefilled. Where a user can quickly mark the item as compliance.

But, i'm stuck where to begin and have been reading over all the formsets documentation. I'm hoping someone could provide some guidance.

0 Answers
Related