summaryrefslogtreecommitdiff
path: root/tbc/forms.py
blob: effe45b5e7bab2c9f06b8a94c17c9a2157e505ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from django import forms
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, UserChangeForm

from tbc.models import *


class UserProfileForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(UserProfileForm, self).__init__(*args, **kwargs)
        self.fields['about'].label = "About Yourself"
        self.fields['insti_org'].label = "Institute/Organizaiton"
        self.fields['dept_desg'].label = "Department/Branch/Designation"
        self.fields['phone_no'].label = "Mobile No"
        self.fields['about_proj'].label = "How did you come to know about the project"
    class Meta:
        model = Profile
        exclude = ('user',)
        widgets = {
        'about':forms.TextInput(attrs={'placeholder':'Tell us about yourself'}),
        'dob':forms.TextInput(attrs={'placeholder':'mm/dd/yyyy'}),
        'insti_org':forms.TextInput(attrs={'placeholder':'Name of University/Organizaiton(if corporate)'}),
        'dept_desg':forms.TextInput(attrs={'placeholder':'Name of the Department/Branch or your designation'}),
        'phone_no':forms.TextInput(attrs={'placeholder':'Phone Number Please'}),
        }
        
        
class UserRegisterForm(UserCreationForm):
    class Meta:
        model = User
        fields = ('first_name', 'last_name', 'email',
                  'username', 'password1', 'password2')
        

class UserLoginForm(forms.Form):
    username = forms.CharField(widget=forms.TextInput(attrs={
                               'class': 'form-control',
                               'placeholder': 'Username'}), label='')
    password = forms.CharField(widget=forms.PasswordInput(attrs={
                               'class': 'form-control',
                               'placeholder': 'Password'}), label='')


class PasswordResetForm(forms.Form):
    new_password = forms.CharField(widget=forms.PasswordInput(attrs={
                               'class': 'form-control',
                               'placeholder': 'New Password'}), label='')
    confirm_new_password = forms.CharField(widget=forms.PasswordInput(attrs={
                               'class': 'form-control',
                               'placeholder': 'Confirm New Password'}), label='')
                               


class BookForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(BookForm, self).__init__(*args, **kwargs)
        self.fields['publisher_place'].label = "Publisher with Place"
        self.fields['isbn'].label = "ISBN No."
        self.fields['edition'].label = "Book Edition"
        self.fields['year_of_pub'].label = "Year of Publication"
        self.fields['no_chapters'].label = "Number of Chapters"
    class Meta:
        model = Book
        exclude = ('contributor', 'approved', 'reviewer', 'tags')
        widgets = {
        'title':forms.TextInput(attrs={'placeholder':'Title of the Book'}),
        'author':forms.TextInput(attrs={'placeholder':'Author of the Book'}),
        'publisher_place':forms.TextInput(attrs={'placeholder':'Name of the Publisher with Place'}),
        'isbn':forms.TextInput(attrs={'placeholder':'Valid ISBN no. of the Book'}),
        'edition':forms.TextInput(attrs={'placeholder':'Edition of the Book'}),
        'year_of_pub':forms.TextInput(attrs={'placeholder':'Year when the Book was published'}),
        'no_chapters':forms.TextInput(attrs={'placeholder':'Total number of chapters in the Book (only include chapters that have solved examples)'}),
        'start_time': forms.DateInput(attrs={'class':'datepicker', 'placeholder':'mm/dd/yyyy'}),
        'end_time': forms.DateInput(attrs={'class':'datepicker', 'placeholder':'mm/dd/yyyy'}),
        }