Ignore:
Timestamp:
Sep 7, 2011, 8:06:09 PM (13 years ago)
Author:
rick
Message:
  • Yield error on form failure.

-the set is only done ones, while function get evaluated every time.

File:
1 edited

Legend:

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

    r9661 r9674  
    3939from django.core.files.base import ContentFile
    4040
     41def get_apperatuur_choices(item):
     42  return sorted(set(Apparatuur.objects.values_list(item,item)))
     43
    4144class MeetBestandForm(forms.Form):
    4245    naam = forms.ChoiceField(choices=Gebruiker.objects.values_list('naam','naam'))
    43     kaart = forms.ChoiceField(choices=set(Apparatuur.objects.values_list('kaart','kaart')))
    44     antenne = forms.ChoiceField(choices=set(Apparatuur.objects.values_list('antenne','antenne')))
     46    kaart = forms.ChoiceField(choices=get_apperatuur_choices('kaart'))
     47    antenne = forms.ChoiceField(choices=get_apperatuur_choices('antenne'))
    4548    bestand = forms.FileField()
    4649
     
    6669      else:
    6770        return HttpResponseServerError('ERROR File does already exists')
    68        
     71    else:
     72      return HttpResponseServerError('ERROR No valid input')
    6973  else:
    7074    form = MeetBestandForm()
Note: See TracChangeset for help on using the changeset viewer.