Changeset 9750 for src/django_gheat/wlheatmap
- Timestamp:
- Dec 3, 2011, 12:31:32 PM (13 years ago)
- Location:
- src/django_gheat/wlheatmap
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/forms.py
r9749 r9750 13 13 14 14 class MeetBestandForm(forms.Form): 15 username = forms.CharField() 16 password = forms.CharField() 17 naam = forms.ChoiceField(choices=Gebruiker.objects.values_list('naam','naam')) 18 kaart = forms.ChoiceField(choices=get_apperatuur_choices('kaart')) 19 antenne = forms.ChoiceField(choices=get_apperatuur_choices('antenne')) 20 surveyid = forms.CharField() 21 bestand = forms.FileField() 15 def get_help_text(model, item): 16 return "Reeds bekend: %s" % ','.join(model.objects.values_list(item,flat=True).distinct()) 17 username = forms.CharField() 18 password = forms.CharField() 19 naam = forms.CharField(help_text=get_help_text(Gebruiker, 'naam')) 20 kaart = forms.CharField(help_text=get_help_text(Apparatuur, 'kaart')) 21 antenne = forms.CharField(help_text=get_help_text(Apparatuur, 'antenne')) 22 surveyid = forms.CharField(help_text=get_help_text(MeetRondje, 'naam')) 23 bestand = forms.FileField() 22 24 23 25 # … … 35 37 login(request, user) 36 38 37 gebruiker = Gebruiker.objects.get(naam=form.cleaned_data['naam'])39 gebruiker, created = Gebruiker.objects.get_or_create(naam=form.cleaned_data['naam']) 38 40 apparatuur, created = Apparatuur.objects.get_or_create(kaart=form.cleaned_data['kaart'], 39 41 antenne=form.cleaned_data['antenne']) … … 49 51 return HttpResponse('OK: Attached to meetrondje %s' % meetrondje) 50 52 else: 51 return HttpResponseServerError('ERROR: File does already exists')53 return HttpResponseServerError('ERROR: File %s does already exists' % meetbestand) 52 54 else: 53 55 return HttpResponseServerError('ERROR: No valid input') -
src/django_gheat/wlheatmap/templates/add_file.html
r9749 r9750 2 2 {% block content %} 3 3 <form enctype="multipart/form-data" action="" method="post"> 4 {{ form.as_p }} 4 <table> 5 {{ form.as_table }} 6 </table> 5 7 <input type="submit" value="Submit" /> 6 8 </form>
Note:
See TracChangeset
for help on using the changeset viewer.