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 .

from django import forms
from pytask.taskapp.models import Task, Claim

class TaskCreateForm(forms.ModelForm):
    class Meta:
        model = Task
        fields = ['title', 'desc', 'tags', 'credits']
    publish = forms.BooleanField(required=False)

def AddMentorForm(choices,instance=None):
    """ return a form object with appropriate choices """
    
    class myform(forms.Form):
        mentor = forms.ChoiceField(choices=choices, required=True)
    form = myform(instance=instance) if instance else myform()
    return form

class ClaimTaskForm(forms.ModelForm):
    class Meta:
        model = Claim
        fields = ['message']