taskapp/forms/task.py
changeset 22 36d3173ab7f9
parent 21 c28774fe7ffd
child 25 c0e4fc8b8b5b
equal deleted inserted replaced
21:c28774fe7ffd 22:36d3173ab7f9
     1 from django import forms
     1 from django import forms
     2 from pytask.taskapp.models import Task
     2 from pytask.taskapp.models import Task, Claim
     3 
     3 
     4 class TaskCreateForm(forms.ModelForm):
     4 class TaskCreateForm(forms.ModelForm):
     5     class Meta:
     5     class Meta:
     6         model = Task
     6         model = Task
     7         fields = ['title', 'desc', 'tags', 'credits']
     7         fields = ['title', 'desc', 'tags', 'credits']
    13     class myform(forms.Form):
    13     class myform(forms.Form):
    14         mentor = forms.ChoiceField(choices=choices, required=True)
    14         mentor = forms.ChoiceField(choices=choices, required=True)
    15     form = myform(instance=instance) if instance else myform()
    15     form = myform(instance=instance) if instance else myform()
    16     return form
    16     return form
    17 
    17 
    18 def ClaimTaskForm(models.ModelForm):
    18 class ClaimTaskForm(forms.ModelForm):
    19     class Meta:
    19     class Meta:
    20         model = Claim
    20         model = Claim
    21         fields = ['message']
    21         fields = ['message']