pytask/taskapp/forms/task.py
author nishanth
Mon, 01 Feb 2010 15:00:40 +0530
changeset 18 293692eb8f06
parent 15 c6038cbf8a39
permissions -rw-r--r--
added the functionality to assign a task to one of the claimed users.
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']
18
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    22
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    23
def AssignTaskForm(choices, instance=None):
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    24
    """ return a form object with appropriate choices """
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    25
    
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    26
    class myform(forms.Form):
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    27
        user = forms.ChoiceField(choices=choices, required=True)
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    28
    form = myform()
293692eb8f06 added the functionality to assign a task to one of the claimed users.
nishanth
parents: 15
diff changeset
    29
    return form