I'm building a form for the user model that creates a User, but I only want
it to make the creator enter an email address.

To do this I want to make the username field be hidden.

I'm trying to do this by making the widget be a HiddenInput.

Here is my form:

class FooCreationForm(forms.ModelForm):
    username = forms.RegexField(label=_("Username"), max_length=30,
                                regex=r'^[...@+-]+$')
    email = forms.EmailField(label=_("E-mail address"))

    class Meta:
        model = User
        fields = ("email",)
        widgets = {
            'username': forms.HiddenInput
        }

I was expecting the username to turn into an input with the attribute
type set to hidden, but instead it's still a regular input.

What am I doing wrong here?

Jacob

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to