Total Complexity | 2 |
Total Lines | 14 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from django import forms |
||
35 | class ThreadReplyForm(forms.Form): |
||
36 | """ Form for replying to threads """ |
||
37 | body = forms.CharField(label='Reply', widget=forms.Textarea) |
||
38 | |||
39 | def save(self, user, thread): |
||
40 | """ Save the contents of the form. |
||
41 | |||
42 | Creates a new reply on the given thread by the given user. |
||
43 | """ |
||
44 | if self.is_valid(): |
||
45 | return models.Message.objects.create( |
||
46 | user=user, |
||
47 | thread=thread, |
||
48 | body=self.cleaned_data['body']) |
||
49 |