1👍
✅
If I got you right, your particular question is about constructing a form with checkboxes for all the model’s fields. Here’s the way to do it:
class ReviewForm(forms.Form):
def __init__(self, model, *args, **kwargs):
super(ReviewForm, self).__init__(self, *args, **kwargs)
for field in model._meta.get_fields():
self.fields[field.name] = forms.BooleanField(label=field.name, initial=True)
def triage_view(request, *args, **kwargs):
form = ReviewForm(Entry, data=request.POST or None)
# do stuff with that form, for example
accepted_field_names = [key for key, val in form.cleaned_data if val]
Source:stackexchange.com