23 lines
1.3 KiB
Python
23 lines
1.3 KiB
Python
from django import forms
|
|
from .models import User
|
|
from django.contrib.auth.forms import UserCreationForm
|
|
|
|
|
|
class RegisterForm(UserCreationForm):
|
|
class Meta:
|
|
model = User
|
|
fields = ['first_name', 'last_name', 'email', 'password1', 'password2']
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.fields['first_name'].widget.attrs.update(
|
|
{'class': 'shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline'})
|
|
self.fields['last_name'].widget.attrs.update(
|
|
{'class': 'shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline'})
|
|
self.fields['email'].widget.attrs.update(
|
|
{'class': 'shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline'})
|
|
self.fields['password1'].widget.attrs.update(
|
|
{'class': 'shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline'})
|
|
self.fields['password2'].widget.attrs.update(
|
|
{'class': 'shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline'})
|