I have 3 models, the idea is that i can do many test on one product and a 
product can be removed of my stock (insert values in out table) by peoples. 
In django admin how can i do for blocking to insert values in Test table 
when the product is in the out table(inserted in the out table)? Where 
could i write the function to block the adding and how making the error or 
warning message come to the admin interface telling the user that product 
is removed?

class Person (models.Model): 
    name = models.Charfield (max_lenght=15) 

class Product (models.Model): 
    name = models.CharField (max_lenght=15) 
    
outs=models.ManytoMany(Person,related_name="outs_of_product",through="Out") 

class Test(models.Model): 
    testname = models.Charfield (max_lenght=15) 
    product = models.ForeignKey(Product,on_delete=models.CASCADE) 

class Out (models.Model): 
    date= models.DateField () 
    
person=models.ForeignKey(Persone,related_name="peoples_out_product",on_delete=models.CASCADE)
 

    
product=models.ForeignKey(Persone,related_name="products_out",on_delete=models.CASCADE)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a063ac99-42a4-463c-ab32-9308d9983d4d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to