diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bandmap/forms.py	Sun Sep 21 18:20:29 2014 -0500
@@ -0,0 +1,41 @@
+"""Forms for the bandmap application.
+
+"""
+from django import forms
+
+from bandmap.models import BandEntry
+
+
+class BandForm(forms.ModelForm):
+    """This form is used to add bands to the map."""
+    class Meta:
+        model = BandEntry
+        fields = ['name', 'url', 'location', 'note', 'is_active', 'lat', 'lon']
+        labels = {
+            'name': 'Band name',
+            'url': 'Link',
+            'is_active': 'Band is currently active',
+        }
+        help_texts = {
+            'url': 'Link to website or web presence (optional)',
+            'location': 'See examples, above',
+        }
+        widgets = {
+            'name': forms.TextInput(attrs={
+                'size': 64,
+                'class': 'text'}),
+            'url': forms.TextInput(attrs={
+                'size': 64,
+                'class': 'text',
+                'placeholder': 'http://'}),
+            'location': forms.TextInput(attrs={
+                'size': 64,
+                'class': 'text',
+                'placeholder': 'Huntington Beach, CA, USA'}),
+            'note': forms.TextInput(attrs={
+                'size': 64,
+                'class': 'text',
+                'placeholder': 'Optional short note about the band'}),
+            'lat': forms.HiddenInput(),
+            'lon': forms.HiddenInput(),
+        }