Commits

Anonymous committed 5eb1862

Minor cleanup in the CAPTCHA form

  • Participants
  • Parent commits 68fca00

Comments (0)

Files changed (1)

     
     """
     def __init__(self, captcha_value="swordfish", *args, **kwargs):
-        super(CaptchaContactForm, self).__init__(*args, **kwargs)
-        self.fields['hash'] = sha.new(captcha_value + settings.SECRET_KEY).hexdigest()
+        initial_data = { 'hash': sha.new(captcha_value + settings.SECRET_KEY).hexdigest() }
+        super(CaptchaContactForm, self).__init__(initial=initial, *args, **kwargs)
         self.fields['captcha'].label = 'Type the word "%s" (to deter automated spam bots)' % captcha_value
     
     captcha = forms.CharField(widget=forms.TextInput(attrs=attrs_dict))