cleaned_data doldurmak için form üzerinde form.is_valid()
aramaya gerek bir kullanıcı ben models.py oluşturduğunuz tablo)
from allauth.account.adapter import DefaultAccountAdapter # refer to allauth.account.adapter
from stashd.models import User, AccountProfile
import datetime, json
class MyAccountAdapter(DefaultAccountAdapter):
def save_user(self, request, user, form, commit=True):
system_account = super(StashdAccountAdapter, self).save_user(request, user, form, commit)
print form
## Print form shows all the data, but the cleaned_data get's rid of it
data = form.cleaned_data
first_name = data.get('first_name')
username = data.get('username')
last_name = data.get('last_name')
email = data.get('email')
# gender = data.get('gender')
# yob = data.get('yob')
# dob = datetime.date(int(yob), 1, 1)
info = {}
# for k, v in [('first', username), ('first', first_name), ('last', last_name), ('email', email)]:
# if v:
# info[k] = v
for k, v in [('email', email)]: #,('dob',dob),('gender',gender)
if v:
info[k] = v
user = User(**info)
user.save()
AccountProfile(user=user, account=system_account).save()
return system_account
Formdaki hataları denetleyebilir misiniz ('print form._errors')? – mariodev