samedi 13 juillet 2019

How to you put a checkbox in a django.contrib.auth.forms UserCreationForm

I have multiple fields in my Django UserCreationForm including the already included username, password 1, and password 2. I have also added and email field. I am unable to add a checkbox.

from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm

class UserRegisterForm(UserCreationForm): email = forms.EmailField(required=True) #checkbox field should go here?

class Meta:
    model = User
    fields = ['username', 'email', 'password1', 'password2']

I want there to be a checkbox to declare if the user wants to register as a teacher or as a student.




Aucun commentaire:

Enregistrer un commentaire