Mercurial > public > sg101
comparison bandmap/forms.py @ 820:9a0df7bd2409
Bandmap application work in progress.
Model defined.
Map is displaying.
Initial display of add form.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 21 Sep 2014 18:20:29 -0500 |
parents | |
children | bb7e2fc24690 |
comparison
equal
deleted
inserted
replaced
819:38db6ec61af3 | 820:9a0df7bd2409 |
---|---|
1 """Forms for the bandmap application. | |
2 | |
3 """ | |
4 from django import forms | |
5 | |
6 from bandmap.models import BandEntry | |
7 | |
8 | |
9 class BandForm(forms.ModelForm): | |
10 """This form is used to add bands to the map.""" | |
11 class Meta: | |
12 model = BandEntry | |
13 fields = ['name', 'url', 'location', 'note', 'is_active', 'lat', 'lon'] | |
14 labels = { | |
15 'name': 'Band name', | |
16 'url': 'Link', | |
17 'is_active': 'Band is currently active', | |
18 } | |
19 help_texts = { | |
20 'url': 'Link to website or web presence (optional)', | |
21 'location': 'See examples, above', | |
22 } | |
23 widgets = { | |
24 'name': forms.TextInput(attrs={ | |
25 'size': 64, | |
26 'class': 'text'}), | |
27 'url': forms.TextInput(attrs={ | |
28 'size': 64, | |
29 'class': 'text', | |
30 'placeholder': 'http://'}), | |
31 'location': forms.TextInput(attrs={ | |
32 'size': 64, | |
33 'class': 'text', | |
34 'placeholder': 'Huntington Beach, CA, USA'}), | |
35 'note': forms.TextInput(attrs={ | |
36 'size': 64, | |
37 'class': 'text', | |
38 'placeholder': 'Optional short note about the band'}), | |
39 'lat': forms.HiddenInput(), | |
40 'lon': forms.HiddenInput(), | |
41 } |