2021-01-13 22:52:23 +00:00
|
|
|
|
|
|
|
from django import forms
|
|
|
|
from .models import Book
|
|
|
|
|
|
|
|
class NewBookForm(forms.Form):
|
2021-05-07 18:57:50 +00:00
|
|
|
bookid = forms.IntegerField(label='Book ID')
|
2021-01-13 22:52:23 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
2021-02-19 19:41:57 +00:00
|
|
|
class LoginForm(forms.Form):
|
|
|
|
username = forms.CharField(label='Username', max_length=64)
|
2021-04-26 00:34:42 +00:00
|
|
|
password = forms.CharField(label='Password', max_length=64, widget=forms.PasswordInput())
|
2021-02-19 19:41:57 +00:00
|
|
|
def is_valid():
|
|
|
|
return str(username) != '' and str(password) != ''
|
|
|
|
|
|
|
|
|
2021-01-13 22:52:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|