from django import forms
from registration.forms import RegistrationForm
from main.models import UserProfile
from registration.models import RegistrationProfile

class RegistrationFormUserProfile(RegistrationForm):
    name = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)
    city = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)
    country = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)
    organization = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)
    home_page = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)
    twitter = forms.CharField(widget=forms.TextInput(), required=False, max_length=255)

    def save(self, profile_callback=None):
        new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'].lower(),
                password=self.cleaned_data['password1'],
                email=self.cleaned_data['email'])

        new_profile = UserProfile(user=new_user, name=self.cleaned_data['name'],
                city=self.cleaned_data['city'],
                country=self.cleaned_data['country'],
                organization=self.cleaned_data['organization'],
                home_page=self.cleaned_data['home_page'],
                twitter=self.cleaned_data['twitter'])
        new_profile.save()

        return new_user


@@ -153,16 +153,52 @@
 nProfile
+%0Afrom country_field import COUNTRIES
 %0A%0Aclass 
@@ -428,34 +428,36 @@
 untry = forms.Ch
-ar
+oice
 Field(widget=for
@@ -455,32 +455,29 @@
 idget=forms.
-TextInpu
+Selec
 t(), require
@@ -481,38 +481,55 @@
 ired=False, 
-max_length=255
+choices=COUNTRIES, initial='ZZ'
 )%0A    organi

make country a select