~widelands-dev/widelands-website/django_staticfiles

404.2.24 by franku
added the old threadedcomments app as wildelands app
1
from django import forms
2
from threadedcomments.models import DEFAULT_MAX_COMMENT_LENGTH
3
from threadedcomments.models import FreeThreadedComment, ThreadedComment
4
from django.utils.translation import ugettext_lazy as _
5
6
class ThreadedCommentForm(forms.ModelForm):
7
    """
8
    Form which can be used to validate data for a new ThreadedComment.
9
    It consists of just two fields: ``comment``, and ``markup``.
10
    
11
    The ``comment`` field is the only one which is required.
12
    """
13
14
    comment = forms.CharField(
15
        label = _('comment'),
16
        max_length = DEFAULT_MAX_COMMENT_LENGTH,
17
        widget = forms.Textarea
18
    )
19
20
    class Meta:
21
        model = ThreadedComment
22
        fields = ('comment', 'markup')
23
24
class FreeThreadedCommentForm(forms.ModelForm):
25
    """
26
    Form which can be used to validate data for a new FreeThreadedComment.
27
    It consists of just a few fields: ``comment``, ``name``, ``website``,
28
    ``email``, and ``markup``.
29
    
30
    The fields ``comment``, and ``name`` are the only ones which are required.
31
    """
32
33
    comment = forms.CharField(
34
        label = _('comment'),
35
        max_length = DEFAULT_MAX_COMMENT_LENGTH,
36
        widget = forms.Textarea
37
    )
38
39
    class Meta:
40
        model = FreeThreadedComment
41
        fields = ('comment', 'name', 'website', 'email', 'markup')