1
0
Fork 0

openlibrary search

This commit is contained in:
Mouse Reeve 2020-01-29 01:05:27 -08:00
parent dd478a3587
commit c5d0e02166
14 changed files with 91 additions and 63 deletions

43
fedireads/forms.py Normal file
View file

@ -0,0 +1,43 @@
''' usin django model forms '''
from django.forms import ModelForm, PasswordInput
from fedireads import models
class LoginForm(ModelForm):
class Meta:
model = models.User
fields = ['username', 'password']
help_texts = {f: None for f in fields}
widgets = {
'password': PasswordInput(),
}
class RegisterForm(ModelForm):
class Meta:
model = models.User
fields = ['username', 'email', 'password']
help_texts = {f: None for f in fields}
widgets = {
'password': PasswordInput(),
}
class ReviewForm(ModelForm):
class Meta:
model = models.Review
fields = ['name', 'review_content', 'rating']
help_texts = {f: None for f in fields}
labels = {
'name': 'Title',
'review_content': 'Review',
'rating': 'Rating (out of 5)',
}
class EditUserForm(ModelForm):
class Meta:
model = models.User
fields = ['avatar', 'name', 'summary']
help_texts = {f: None for f in fields}