Hello,

The below method is an excerpt taken from the default registration forms.py 
with a few additional inputs.

class RegistrationForm(forms.Form):
   
    keywords = forms.ModelMultipleChoiceField(queryset=Keyword.objects.all())
    
    def save(self, profile_callback=None):

        new_user = 
RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],password=self.cleaned_data['password1'],email=self.cleaned_data['email'],profile_callback=profile_callback)
        new_profile = 
UserProfile(user=new_user,username=self.cleaned_data['username'], 
keywords_subscribed=self.cleaned_data['keywords'],first_name=self.cleaned_data['first_name'],last_name=self.cleaned_data['last_name'],email=self.cleaned_data['email'])
        new_profile.save()       
        return new_user

The highlighted portions will draw your attention to what i'm doing. As you can 
see i'm using a modelmultiplechoicefield which allows me to select multiple 
choices.

However when it gets stored into the database, it appends strange characters ( 
[<Keyword:)

Is there a way to get rid of the special characters? or how is it even 
appearing or getting populated?

Thank you so much.

Screenshot below:





Best Regards,

Stanwin Siow



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<<inline: Screen Shot 2012-02-19 at 7.38.30 PM.png>>

Reply via email to