pytask/taskapp/forms/task.py
author nishanth
Mon, 01 Feb 2010 11:10:29 +0530
changeset 14 f2623fb8041a
parent 11 d28fcc644fbb
child 15 c6038cbf8a39
permissions -rw-r--r--
implemented add another mentor functionality to a task.
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
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
     2
from pytask.taskapp.models import 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
     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
f2623fb8041a implemented add another mentor functionality to a task.
nishanth
parents: 11
diff changeset
    18
def ClaimTaskForm(models.ModelForm):
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']