~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to threadedcomments/forms.py

  • Committer: franku
  • Date: 2016-05-15 14:41:54 UTC
  • mto: This revision was merged to the branch mainline in revision 409.
  • Revision ID: somal@arcor.de-20160515144154-00m3tiibyxm0nw2w
added the old threadedcomments app as wildelands app

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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')
 
 
b'\\ No newline at end of file'