4 sys.path = sys.path + [os.path.dirname(os.path.dirname(os.path.abspath(__file__)))]
5 os.environ['DJANGO_SETTINGS_MODULE']='xerxes.settings'
8 from django.contrib.auth.models import User
9 from xerxes.base.models import UserProfile
10 from datetime import datetime
12 conn = MySQLdb.connect(
13 user = 'ee_inschrijving',
14 passwd = '3c6b362d17aa96d132544fb63f7c8b74',
15 db = 'ee_inschrijving',
27 for row in c.fetchall():
30 u = User.objects.get(username=username)
31 except User.DoesNotExist:
32 u = User(username=username)
39 c.execute("SELECT dyn_prop.name, dyn_prop_value.value"
40 " FROM dyn_prop_value, dyn_prop WHERE"
41 " dyn_prop_value.dynamicPropertyObjectId=%s AND"
42 " dyn_prop_value.dynamicPropertyId = dyn_prop.id", row[2])
45 for row in c.fetchall():
46 props[row[0]] = row[1]
50 names = props.get('Naam','').split(' ', 1)
51 u.first_name = names[0]
53 u.last_name = names[1]
54 if username != 'matthijs' and username != 'admin':
55 u.email = props.get('Email', '')
56 u.set_unusable_password()
60 except UserProfile.DoesNotExist:
61 p = UserProfile(user=u)
62 p.address = props.get('Adres', '')
63 p.zipcode = props.get('Postcode', '')
64 p.town = props.get('Woonplaats', '')
65 #p.birthdate = props.get('Geboortedatum', '')
66 p.birthdate = datetime.now()
67 p.telephone = props.get('Telefoonnummer', '')
68 if ('Vegatarisch' in props):
69 p.vegetarian = props['Vegetarisch'][0].lower() == 'j'
72 p.foodallergies = props.get('Voedselallergie', '')
73 p.otherallergies = props.get('Allergie', '')
74 p.bloodgroup = props.get('Bloedgroep', '')
75 p.othermedical = props.get('Verschijnselen', '')
76 p.warnname = props.get('WaarschuwenNaam', '')
77 p.warntelephone = props.get('WaarschuwenTelefoon', '')
83 # vim: set sts=4 sw=4 expandtab: