diff options
author | lxf <sng@luxagraf.net> | 2022-05-14 16:38:07 -0400 |
---|---|---|
committer | lxf <sng@luxagraf.net> | 2022-05-14 16:38:07 -0400 |
commit | bb3973ffb714c932e9ec6dd6a751228dc71fe1d3 (patch) | |
tree | 6fa32f9392ad2ec32271349b86a4c1388fd6ba95 /app/accounts/forms.py |
initial commit
Diffstat (limited to 'app/accounts/forms.py')
-rw-r--r-- | app/accounts/forms.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/app/accounts/forms.py b/app/accounts/forms.py new file mode 100644 index 0000000..2da08cb --- /dev/null +++ b/app/accounts/forms.py @@ -0,0 +1,28 @@ +from django import forms +from django.utils.translation import ugettext_lazy as _ +from django_registration.forms import RegistrationForm + +from .models import User, UserProfile + + +class UserForm(RegistrationForm): + class Meta(RegistrationForm.Meta): + model = User + + +class ProfileForm(forms.ModelForm): + class Meta: + model = UserProfile + fields = ['bio', 'photo', 'website'] + labels = { + "photo": _("Profile photo"), + "bio": _("Bio. A little about you. links are fine, line breaks are not. Keep it short and sweet, 350 characters max"), + "website": _("If you have a personal website, plug it in here."), + } + widgets = { + 'bio': forms.Textarea(attrs={'cols': 104, 'rows': 10, 'class': 'textarea-rounded'}), + } + + def __init__(self, *args, **kwargs): + self.user = kwargs.pop("user", None) + super(ProfileForm, self).__init__(*args, **kwargs) |