from django.contrib.auth import get_user_model
from django import forms


class SignupForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(SignupForm, self).__init__(*args, **kwargs)

    class Meta:
        model = get_user_model()
        fields = ['first_name', 'last_name',]

    def signup(self, request, user):
        user.first_name = self.cleaned_data['first_name']
        user.last_name = self.cleaned_data['last_name']
        user.save()