Mercurial > public > sg101
view membermap/forms.py @ 1166:130ac1e98cf4
More V3 forums tweaking.
Adding attachments is working now.
Adding a post via ajax is working.
Still need to display attachments on posts.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 20 Aug 2017 15:55:54 -0500 |
parents | 26f2b83e7468 |
children |
line wrap: on
line source
""" Forms for the member map application. """ from django import forms from core.html import ImageCheckError from core.html import image_check from core.markup import site_markup from membermap.models import MapEntry class MapEntryForm(forms.ModelForm): location = forms.CharField(required=True, label='Your Location') message = forms.CharField(required=False, label='Your Message', widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) def clean_message(self): message = self.cleaned_data['message'] self.html = None if message: self.html = site_markup(message) try: image_check(self.html) except ImageCheckError as ex: raise forms.ValidationError(str(ex)) return message class Meta: model = MapEntry fields = ('location', 'message')