bookshelf-management/bookshelf_management/apps/mgmt/forms.py

20 lines
395 B
Python
Raw Normal View History

2021-01-13 22:52:23 +00:00
from django import forms
from .models import Book
class NewBookForm(forms.Form):
bookid = forms.CharField(label='Book ID', max_length=12)
def is_valid():
return Book.objects.get(self.bookid) != None
2021-02-12 01:05:08 +00:00
class BookSearchForm(forms.Form):
searchTerm = forms.CharField(label='Search Term', max_length=64)
def is_valid():
return str(searchTerm) != ''
2021-01-13 22:52:23 +00:00