Validate form fields in django verifying their existence in the database

1

How to validate fields of a form in django by consulting its existence in the database (eg: the ID of a record)

    
asked by Oscar E. Monterroso G. 12.09.2018 в 17:08
source

1 answer

0

you can put the attribute of your model the following unique=True , something like this: id = models.CharField(blank=False, null=False, unique=True) , with this django it verifies if in the database exists some object created with this id

    
answered by 13.09.2018 в 19:54