i want a error msg that the entry is already there in django forms for a particular field -
I am using model forms. My form contains a code named How Can I Do It My Form My item is getting an area in the table Add it to your form method: tagged . If I enter
tagged in the
tagged field and then I am submitting the form if the entered
tagis already exist in the database and It should say "Tag ID already exists" above the Tag ID field, then the form should not be stored in the database.
Class Inventory Items (Model Form): Class Meta: Model = Items
tags so if I am entering existing
tagid and if I submit. It should throw up an indication or text or something like "the signal ID already exists"
def clean_tagid (auto): data = self.cleaned_data ['tagid'] if item.objects.filter (tagid = data) .count (): Increase forms Validation error ("Tagged already exists") Return data
Comments
Post a Comment