[Answer]-Model form validation using django

1👍

def clean_book_name(self):
    book_name = self.cleaned_data['book_name']
    if not book_name:
        raise forms.ValidationError('field mandatory')
    return book_name

Leave a comment