Mercurial > public > sg101
annotate membermap/forms.py @ 629:f4c043cf55ac
Wiki integration. Requests don't always have sessions.
In particular this occurs when a request is made without a trailing slash.
The Common middleware redirects when this happens, and the middleware
process_request() processing stops before a session can get added.
So just set an attribute on the request object for each operation.
This seemed weird to me at first, but there are plenty of examples of this
in the Django code base already.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 13 Nov 2012 13:50:06 -0600 |
parents | ee87ea74d46b |
children | 21c592cac71c |
rev | line source |
---|---|
gremmie@1 | 1 """ |
gremmie@1 | 2 Forms for the member map application. |
gremmie@1 | 3 """ |
gremmie@1 | 4 from django import forms |
bgneal@6 | 5 from django.conf import settings |
bgneal@6 | 6 |
gremmie@1 | 7 from membermap.models import MapEntry |
gremmie@1 | 8 |
gremmie@1 | 9 |
gremmie@1 | 10 class MapEntryForm(forms.ModelForm): |
bgneal@312 | 11 location = forms.CharField(required=True, |
bgneal@133 | 12 widget=forms.TextInput(attrs={'size': 64, 'maxlength': 255})) |
bgneal@312 | 13 message = forms.CharField(required=False, |
bgneal@133 | 14 widget=forms.Textarea(attrs={'class': 'markItUp smileyTarget'})) |
gremmie@1 | 15 |
gremmie@1 | 16 class Meta: |
gremmie@1 | 17 model = MapEntry |
gremmie@1 | 18 fields = ('location', 'message') |
gremmie@1 | 19 |
gremmie@1 | 20 class Media: |
gremmie@1 | 21 css = { |
bgneal@133 | 22 'all': (settings.GPP_THIRD_PARTY_CSS['markitup'] + |
bgneal@133 | 23 settings.GPP_THIRD_PARTY_CSS['jquery-ui']) |
gremmie@1 | 24 } |
bgneal@133 | 25 js = (settings.GPP_THIRD_PARTY_JS['markitup'] + |
bgneal@133 | 26 settings.GPP_THIRD_PARTY_JS['jquery-ui']) |
gremmie@1 | 27 |