1
#!/usr/bin/env python -tt
4
# Created by Timo Wingender <timo.wingender@gmx.de> on 2010-06-02.
6
# Last Modified: $Date$
9
from django import forms
10
from models import GGZAuth
11
from django.utils.translation import ugettext_lazy as _
18
class EditGGZForm(forms.ModelForm):
19
password = forms.CharField(label=_(u'GGZ password'), widget = forms.PasswordInput(render_value = False), required=True)
23
fields = [ 'password', ]
25
def __init__(self, *args, **kwargs):
26
instance = kwargs.pop("instance")
28
print "instance: %s, kwargs: %s" % (instance, kwargs)
29
super(EditGGZForm, self).__init__(instance=instance, *args,**kwargs)
31
def clean_password(self):
32
pw = self.cleaned_data['password']
34
pw_hash = hashlib.sha1(pw).digest()
35
pw_base64 = base64.standard_b64encode(pw_hash)
36
print "sha1: %s" % (pw_hash)
37
print "base: %s" % (pw_base64)
42
super(EditGGZForm, self).save()