pytask/taskapp/forms/task.py
author nishanth
Mon, 01 Feb 2010 11:41:26 +0530
changeset 15 c6038cbf8a39
parent 14 f2623fb8041a
child 18 293692eb8f06
permissions -rw-r--r--
addded link to view claims in 'view task' page .
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     1
from django import forms
15
c6038cbf8a39 addded link to view claims in 'view task' page .
nishanth
parents: 14
diff changeset
     2
from pytask.taskapp.models import Task, Claim
11
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     3
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     4
class TaskCreateForm(forms.ModelForm):
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     5
    class Meta:
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     6
        model = Task
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     7
        fields = ['title', 'desc', 'tags', 'credits']
d28fcc644fbb implemented create task view which needed task.py in events. added a method show_msg to views/user.py and used it in logoff view.
nishanth
parents: 5
diff changeset
     8
    publish = forms.BooleanField(required=False)
14
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
     9
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    10
def AddMentorForm(choices,instance=None):
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    11
    """ return a form object with appropriate choices """
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    12
    
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    13
    class myform(forms.Form):
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    14
        mentor = forms.ChoiceField(choices=choices, required=True)
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    15
    form = myform(instance=instance) if instance else myform()
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    16
    return form
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    17
15
c6038cbf8a39 addded link to view claims in 'view task' page .
nishanth
parents: 14
diff changeset
    18
class ClaimTaskForm(forms.ModelForm):
14
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    19
    class Meta:
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    20
        model = Claim
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    21
        fields = ['message']