Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django unique validator

from rest_framework.validators import UniqueValidator

slug = SlugField(
    max_length=100,
    validators=[UniqueValidator(queryset=BlogPost.objects.all())]
)
Source by www.django-rest-framework.org #
 
PREVIOUS NEXT
Tagged: #django #unique #validator
ADD COMMENT
Topic
Name
3+4 =