pytask/taskapp/forms/user.py
author anoop
Mon, 01 Feb 2010 17:30:30 +0530
changeset 22 943a35c14cf7
parent 21 3e676fa948c4
permissions -rw-r--r--
added browse users functionality, added user/browse.html, fixed view my profile template.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     1
#!/usr/bin/python2.5
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     2
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     3
from django import forms
16
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
     4
from pytask.taskapp.models import GENDER_CHOICES, Profile
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
     5
from django.forms import ModelForm
6
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     6
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     7
class RegistrationForm(forms.Form):
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     8
    username = forms.CharField(max_length=30, required=True)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
     9
    password = forms.CharField(max_length=60, required=True, widget=forms.PasswordInput)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    10
    repeat_password = forms.CharField(max_length=60, required=True, widget=forms.PasswordInput)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    11
    email = forms.EmailField(max_length=30, required=True)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    12
    gender = forms.ChoiceField(choices=GENDER_CHOICES, required = True)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    13
    dob = forms.DateField(required=True, help_text = "(YYYY-MM-DD)")
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    14
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    15
class LoginForm(forms.Form):
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    16
    username = forms.CharField(max_length=30, required=True)
94136f9a48bc added login, logout, and register.
anoop
parents: 5
diff changeset
    17
    password = forms.CharField(max_length=60, required=True, widget=forms.PasswordInput)
16
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
    18
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
    19
class UserProfileEditForm(ModelForm):
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
    20
    class Meta:
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
    21
        model = Profile
d57e63325759 added view profile and edit profile functionalities.
anoop
parents: 6
diff changeset
    22
        exclude = ('user','rights','dob','credits')