Models unique_together issue

Hi, I have this model


class Manifold_monitoring(models.Model):
    MFD_type      = models.ForeignKey(Manifo_types , on_delete=models.CASCADE)
    DATE_TEST     = models.DateField()
    Pressure_MFD  = models.DecimalField(max_digits=15, decimal_places=3,null=True, blank=True)
    Pressure_SP   = models.DecimalField(max_digits=15, decimal_places=3,null=True, blank=True)
    .....
    def __str__(self):
        if self.MFD_type.Type and self.MFD_type.Fluid_N:
            return str(self.MFD_type.MFDsID.MFDsID +' '+ self.MFD_type.Type +' '+ self.MFD_type.Fluid_N)
        else:
            return str(self.MFD_type.MFDsID.MFDsID +' '+ self.MFD_type.Type)
   def get_absolute_url(self):
        return reverse('WellNetwork')
    class Meta:
        ordering = ('-post_date',)
        unique_together=[['MFD_type','DATE_TEST']]

everything works well when I add data from the Admin panel.

so when adding data twice it prevents me (unique_together).

but using the views function it save the data and bypass the unique_together condition?
I am using AJAX to send data from HTML page to the views function.

def AddManifold_Monto(request):
    form = Manifold_monitoring_F()
    model = Manifold_monitoring.objects.filter( DATE_TEST__exact= datetime.date.today())
    if request.method == 'POST':
        try:
            MFD_type    = request.POST.get('MFD_type')
            DATE_TEST   = request.POST.get('DATE_TEST')
            Pressure_SP = request.POST.get('Pressure_SP')
            Pressure_MFD = request.POST.get('Pressure_MFD')
            manold_mntorng = Manifold_monitoring()
            manold_mntorng.MFD_type_id   = MFD_type
            manold_mntorng.DATE_TEST   = DATE_TEST   
            manold_mntorng.Pressure_SP = Pressure_SP 
            manold_mntorng.Pressure_MFD= Pressure_MFD
            manold_mntorng.author = request.user
            manold_mntorng.save()
            messages.success(request,'You successfully added '+ str(manold_mntorng.MFD_type) +' to Manifolds List')  # for python 3.5
            return redirect('Add_ManifolMntr')
        except:
            messages.warning(request, 'Already exists, check input data!!!')
            return redirect('Add_ManifolMntr')
    context={
        'title':'Manifold Monitoring',   #+str(datetime.date.today),
        'model':model,
        'form': form,
    }
    return render(request,'Home/Production_Ser/MFD_Monitor/ADDMFD_Monitor.html',context)

So what is the solution or do I need to add a validators function to the model?

Since “unique_together” is handled at the database layer, you can check the database to see whether that clause had been applied.

After addding that clause, did you do a makemigrations/migrate to update the database?

Also, what database engine are you using?

Yes, you are alright but I had a migration problem.
I solved it by deleting the migration files of the table. and then delete the table using another program (SQLiteStudio). and then I deleted the migration record in the django_migrations table also.
and run makemigrations/migrate
the problem is solved many thanks