Is there a way to control the formset properly?

That all fits into the category of form and formset validation. In general, you’ve got two choices - you either test those forms on submittal and reject them with an appropriate error message if you want to give the end-user a chance to correct their mistake, or you handle each of the forms individually and save or not save them depending upon their state. Once you reach that point, there’s no value in trying to “delete those forms” - you just don’t save them.

Oh okay. But if its just a single field, i got a rough idea on how to do it. But this is a formset though. How do i combine the validation?
For single field, I have this:

def clean_hostname(self):
   hostname = self.cleaned_data['hostname']
   if len(hostname) < 8:
   raise forms.ValidationError(f'Hostname needs to be more than 8 character long, {hostname}')
   return hostname

Is there some way to request.POST.get in forms.py like i did in views.py? Because what I did in my view was request.POST.get the specific value, compare it and did the logic test to store the data in another table

Review the docs on

Referring to the custom formset validation. This is done in views.py? Sorry, I am still not experience at using Django and sometime confuse which py file it belongs to

My suggestion would be to put your base formset class in your forms.py. That’s where I tend to stick anything form-related.

Oh okay. Thank you very much for the suggestion !