openlibrary search
This commit is contained in:
parent
dd478a3587
commit
c5d0e02166
14 changed files with 91 additions and 63 deletions
43
fedireads/forms.py
Normal file
43
fedireads/forms.py
Normal 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}
|
Loading…
Add table
Add a link
Reference in a new issue