~widelands-dev/widelands-website/trunk

« back to all changes in this revision

Viewing changes to threadedcomments/forms.py

  • Committer: kaputtnik
  • Date: 2019-05-30 18:20:02 UTC
  • mto: This revision was merged to the branch mainline in revision 540.
  • Revision ID: kaputtnik-20190530182002-g7l91m1xo28clghv
adjusted README; first commit on the new server

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 ThreadedComment
 
4
from django.utils.translation import ugettext_lazy as _
 
5
 
 
6
 
 
7
class ThreadedCommentForm(forms.ModelForm):
 
8
    """
 
9
    Form which can be used to validate data for a new ThreadedComment.
 
10
    It consists of just two fields: ``comment``, and ``markup``.
 
11
 
 
12
    The ``comment`` field is the only one which is required.
 
13
    """
 
14
 
 
15
    comment = forms.CharField(
 
16
        label=_('comment'),
 
17
        max_length=DEFAULT_MAX_COMMENT_LENGTH,
 
18
        widget=forms.Textarea
 
19
    )
 
20
 
 
21
    class Meta:
 
22
        model = ThreadedComment
 
23
        fields = ('comment', 'markup')