bgneal@820: """Forms for the bandmap application. bgneal@820: bgneal@820: """ bgneal@820: from django import forms bgneal@820: bgneal@820: from bandmap.models import BandEntry bgneal@820: bgneal@820: bgneal@820: class BandForm(forms.ModelForm): bgneal@820: """This form is used to add bands to the map.""" bgneal@820: class Meta: bgneal@820: model = BandEntry bgneal@820: fields = ['name', 'url', 'location', 'note', 'is_active', 'lat', 'lon'] bgneal@820: labels = { bgneal@820: 'name': 'Band name', bgneal@820: 'url': 'Link', bgneal@820: 'is_active': 'Band is currently active', bgneal@820: } bgneal@820: help_texts = { bgneal@820: 'url': 'Link to website or web presence (optional)', bgneal@820: 'location': 'See examples, above', bgneal@820: } bgneal@820: widgets = { bgneal@820: 'url': forms.TextInput(attrs={ bgneal@1109: 'aria-describedby': 'url-help-text', bgneal@820: 'placeholder': 'http://'}), bgneal@820: 'location': forms.TextInput(attrs={ bgneal@1109: 'aria-describedby': 'location-help-text', bgneal@820: 'placeholder': 'Huntington Beach, CA, USA'}), bgneal@820: 'note': forms.TextInput(attrs={ bgneal@820: 'placeholder': 'Optional short note about the band'}), bgneal@820: 'lat': forms.HiddenInput(), bgneal@820: 'lon': forms.HiddenInput(), bgneal@820: }