author | amit@thunder |
Mon, 14 Jun 2010 01:00:59 +0530 | |
changeset 3 | 34d0c21e3352 |
parent 2 | 654c583fd78e |
child 4 | 4d5422e5a45d |
permissions | -rw-r--r-- |
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
1 |
from django import forms |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
2 |
from registration.forms import RegistrationForm |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
3 |
from django.utils.translation import ugettext_lazy as _ |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
4 |
from testapp.models import Test_User |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
5 |
from registration.models import RegistrationProfile |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
6 |
#from google.appengine.ext.db import djangoforms |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
7 |
import models |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
8 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
9 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
10 |
attrs_dict = { 'class': 'required' } |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
11 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
12 |
PROBLEM_CHOICES=( |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
13 |
('P', 'Plotting'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
14 |
('S', 'Scripting'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
15 |
) |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
16 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
17 |
SESSION_CHOICES=( |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
18 |
('A','DAY 1 SESSION 1'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
19 |
('B','DAY 1 SESSION 2'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
20 |
('C','DAY 1 SESSION 3'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
21 |
('D','DAY 1 SESSION 4'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
22 |
('E','DAY 2 SESSION 1'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
23 |
('F','DAY 2 SESSION 2'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
24 |
('G','DAY 2 SESSION 3'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
25 |
('H','DAY 2 SESSION 4'), |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
26 |
) |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
27 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
28 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
29 |
class ProblemForm(forms.Form): |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
30 |
Description = forms.CharField(widget=forms.Textarea(attrs={'rows': '10', 'cols': '80'}),required=True,help_text="To be used as the question") |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
31 |
Problem_type = forms.ChoiceField(choices=PROBLEM_CHOICES,required=True) |
2 | 32 |
Solution = forms.CharField(widget=forms.Textarea(attrs={'rows': '10', 'cols': '80'}),help_text="comma seperated in case of multiple solutions",required=False) |
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
33 |
Solution_Image = forms.ImageField(required=False) |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
34 |
Session = forms.ChoiceField(choices=SESSION_CHOICES, required=True) |
1 | 35 |
Credit=forms.IntegerField(required=True) |
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
36 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
37 |
class Meta: |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
38 |
model = models.Problem |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
39 |
exclude = ('author', 'created', 'modified') |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
40 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
41 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
42 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
43 |
class Test_UserForm(RegistrationForm): |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
44 |
|
3
34d0c21e3352
Checking if exam has been previously done by the user or not
amit@thunder
parents:
2
diff
changeset
|
45 |
Fullname = forms.CharField(widget=forms.TextInput(attrs=attrs_dict)) |
34d0c21e3352
Checking if exam has been previously done by the user or not
amit@thunder
parents:
2
diff
changeset
|
46 |
Address = forms.CharField(widget=forms.TextInput(attrs=attrs_dict)) |
34d0c21e3352
Checking if exam has been previously done by the user or not
amit@thunder
parents:
2
diff
changeset
|
47 |
|
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
48 |
class Meta: |
3
34d0c21e3352
Checking if exam has been previously done by the user or not
amit@thunder
parents:
2
diff
changeset
|
49 |
exclude = ('special_user','exam_done') |
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
50 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
51 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
52 |
def save(self, profile_callback=None): |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
53 |
new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'], |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
54 |
password=self.cleaned_data['password1'], |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
55 |
email=self.cleaned_data['email']) |
3
34d0c21e3352
Checking if exam has been previously done by the user or not
amit@thunder
parents:
2
diff
changeset
|
56 |
new_profile = Test_User(user=new_user, fullname=self.cleaned_data['Fullname'],address=self.cleaned_data['Address']) |
0
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
57 |
new_profile.save() |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
58 |
return new_user |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
59 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
60 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
61 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
62 |
class UploadForm(forms.Form): |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
63 |
file = forms.FileField() |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
64 |
|
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
65 |
class Meta: |
0b061d58aea3
First commit to Fossee of testapp has the basic Pykata framework on django with some specific changes to Problems model and some views to suit an exam like system
amit@thunder
parents:
diff
changeset
|
66 |
model = None |