~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to threadedcomments/forms.py

  • Committer: franku
  • Date: 2018-05-06 08:20:39 UTC
  • mto: This revision was merged to the branch mainline in revision 494.
  • Revision ID: somal@arcor.de-20180506082039-v8n40alffhi2ulct
This is an Attribute error

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from django import forms
2
2
from threadedcomments.models import DEFAULT_MAX_COMMENT_LENGTH
3
 
from threadedcomments.models import ThreadedComment
 
3
from threadedcomments.models import FreeThreadedComment, ThreadedComment
4
4
from django.utils.translation import ugettext_lazy as _
5
5
 
6
6
 
21
21
    class Meta:
22
22
        model = ThreadedComment
23
23
        fields = ('comment', 'markup')
 
24
 
 
25
 
 
26
class FreeThreadedCommentForm(forms.ModelForm):
 
27
    """
 
28
    Form which can be used to validate data for a new FreeThreadedComment.
 
29
    It consists of just a few fields: ``comment``, ``name``, ``website``,
 
30
    ``email``, and ``markup``.
 
31
 
 
32
    The fields ``comment``, and ``name`` are the only ones which are required.
 
33
    """
 
34
 
 
35
    comment = forms.CharField(
 
36
        label=_('comment'),
 
37
        max_length=DEFAULT_MAX_COMMENT_LENGTH,
 
38
        widget=forms.Textarea
 
39
    )
 
40
 
 
41
    class Meta:
 
42
        model = FreeThreadedComment
 
43
        fields = ('comment', 'name', 'website', 'email', 'markup')