Changeset 9750 for src/django_gheat


Ignore:
Timestamp:
Dec 3, 2011, 12:31:32 PM (13 years ago)
Author:
rick
Message:

Give a hint of which values are available..

Location:
src/django_gheat/wlheatmap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/wlheatmap/forms.py

    r9749 r9750  
    1313
    1414class 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()
    2224
    2325#
     
    3537      login(request, user)
    3638
    37       gebruiker = Gebruiker.objects.get(naam=form.cleaned_data['naam'])
     39      gebruiker, created = Gebruiker.objects.get_or_create(naam=form.cleaned_data['naam'])
    3840      apparatuur, created = Apparatuur.objects.get_or_create(kaart=form.cleaned_data['kaart'],
    3941        antenne=form.cleaned_data['antenne'])
     
    4951        return HttpResponse('OK: Attached to meetrondje %s' % meetrondje)
    5052      else:
    51         return HttpResponseServerError('ERROR: File does already exists')
     53        return HttpResponseServerError('ERROR: File %s does already exists' % meetbestand)
    5254    else:
    5355      return HttpResponseServerError('ERROR: No valid input')
  • src/django_gheat/wlheatmap/templates/add_file.html

    r9749 r9750  
    22{% block content %}
    33<form enctype="multipart/form-data" action="" method="post">
    4 {{ form.as_p }}
     4<table>
     5{{ form.as_table }}
     6</table>
    57<input type="submit" value="Submit" />
    68</form>
Note: See TracChangeset for help on using the changeset viewer.