Skip to content

Instantly share code, notes, and snippets.

@gen1us2k
Created December 4, 2019 08:08
Show Gist options
  • Select an option

  • Save gen1us2k/1b11f6a3116fd8e8bea11280250c8ed4 to your computer and use it in GitHub Desktop.

Select an option

Save gen1us2k/1b11f6a3116fd8e8bea11280250c8ed4 to your computer and use it in GitHub Desktop.
from django import forms
class ForecastForm(forms.Form):
city = forms.CharField()
def clean_city(self):
if 'city' not in self.cleaned_data:
raise forms.ValidationError("Invalid city", "invalid")
return self.cleaned_data['city']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment