Mercurial > public > sg101
comparison messages/forms.py @ 810:4a4fa174a0ec
Private message refactor: adding ability to report PM's.
See also Bitbucket issue #57.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 06 Sep 2014 16:58:08 -0500 |
parents | 0f0ba45704b7 |
children | 999a71b81111 |
comparison
equal
deleted
inserted
replaced
809:ab3deff7672a | 810:4a4fa174a0ec |
---|---|
9 from django.core.urlresolvers import reverse | 9 from django.core.urlresolvers import reverse |
10 from django.template.loader import render_to_string | 10 from django.template.loader import render_to_string |
11 | 11 |
12 from core.functions import send_mail | 12 from core.functions import send_mail |
13 from core.widgets import AutoCompleteUserInput | 13 from core.widgets import AutoCompleteUserInput |
14 from messages.models import Message | 14 from messages.models import Flag, Message, Options |
15 from messages.models import Options | |
16 from messages import MSG_BOX_LIMIT | 15 from messages import MSG_BOX_LIMIT |
17 | 16 |
18 | 17 |
19 # Maximum size of a private message in characters | 18 # Maximum size of a private message in characters |
20 MESSAGE_MAX = getattr(settings, 'MESSAGES_MAX_SIZE', 8192) | 19 MESSAGE_MAX = getattr(settings, 'MESSAGES_MAX_SIZE', 8192) |
122 class Meta: | 121 class Meta: |
123 model = Options | 122 model = Options |
124 fields = ['attach_signature', 'notify_email'] | 123 fields = ['attach_signature', 'notify_email'] |
125 | 124 |
126 | 125 |
126 class ReportForm(forms.ModelForm): | |
127 class Meta: | |
128 model = Flag | |
129 fields = ['comments'] | |
130 labels = {'comments': ''} | |
131 widgets = { | |
132 'comments': forms.Textarea(attrs={ | |
133 'placeholder': 'Enter a comment for the admin (optional).'}) | |
134 } | |
135 | |
136 | |
127 def notify_receiver(new_msg): | 137 def notify_receiver(new_msg): |
128 """ | 138 """ |
129 This function creates the notification email to notify a user of | 139 This function creates the notification email to notify a user of |
130 a new private message. | 140 a new private message. |
131 """ | 141 """ |