Django Integrity error

I want my admin to be able to login and create users
on my Django app, but each time I try to
create a user I get this error message
IntegrityError at /backoffice/add-exco/
(1062, “Duplicate entry ‘1’ for key ‘user_id’”)
The approach I used was to extend the User model using
a one-to-one link. I also saw a post on stackoverflow
sugesting how to solve this by doing the following

  1. Change your OneToOneField to a ForeignKey

  2. In your form validation make sure that a record does not exist

  3. When creating the form check if an entry already exists and then allo the user to edit it.
    I do not know hw to go abt 2, 3 is there a better approach? Below is my
    code

     class AdditionalProfile(models.Model):
     CHOOSE = ''
     ARTISAN = 'ART'
     BANKER = 'BNK'
     POLITICIAN = 'POL'
     OCCUPATION_FIELD = [
         (ARTISAN, 'Artisan'),
         (CHOOSE, 'Please Choose occupation'),
         (BANKER, 'Banker'),
         (POLITICIAN, 'Politician'),
     ]
    
     CHOOSE_JOB = ''
     MANAGER = 'MGR'
     SUPERVISOR = 'SPRV'
     STAFF = 'STF'
     JOB_CADER = [
         (MANAGER, 'Manager'),
         (CHOOSE_JOB, 'Please Choose a job'),
         (SUPERVISOR, 'Supervisor'),
         (STAFF, 'Staff'),
     ]
     user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
     mobile1 = models.CharField(max_length=15)
     mobile2 = models.CharField(max_length=15, blank=True, null=True)
     occupation = models.CharField(max_length=5, choices=OCCUPATION_FIELD, default=CHOOSE)
     job_cader = models.CharField(max_length=5, choices=JOB_CADER, default=CHOOSE_JOB)
     profile = models.ImageField(blank=True, null=True, upload_to='backend/')
    
     def __str__(self):
         return self.user.username
    

forms.py
class RegisterForm(UserCreationForm):

    username = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'Username'}))

    first_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'Firstname'}))

    last_name = forms.CharField(widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'Lastname'}))

    email = forms.CharField(widget=forms.EmailInput(attrs={'class':'form-control', 'placeholder':'Email'}))

    password1 = forms.CharField(widget=forms.PasswordInput(attrs={'class':'form-control', 'placeholder':'Enter Password'}))

    password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class':'form-control', 'placeholder':'Confirm Password'}))

    class Meta():

        model = User

        fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2')

    def save(self, commit=True):

        user = super().save(commit=False)

        user.username = self.cleaned_data['username']

        user.first_name = self.cleaned_data['first_name']

        user.last_name = self.cleaned_data['last_name']

        user.email = self.cleaned_data['email']

        if commit:

            user.save()

            return user

class UserProfileForm(forms.ModelForm):

    

    class Meta():

        CHOOSE = ''

        ARTISAN = 'ART'

        BANKER = 'BNK'

        POLITICIAN = 'POL'

        OCCUPATION_FIELD = [

            (CHOOSE, 'Please Choose'),

            (ARTISAN, 'Artisan'),

            (BANKER, 'Banker'),

            (POLITICIAN, 'Politician'),

        ]

        CHOOSE_JOB = ''

        MANAGER = 'MGR'

        SUPERVISOR = 'SPRV'

        STAFF = 'STF'

        JOB_CADER = [

            (CHOOSE_JOB, 'Please Choose'),

            (MANAGER, 'Manager'),

            (SUPERVISOR, 'Supervisor'),

            (STAFF, 'Staff'),

        ]

        model = AdditionalProfile

        exclude = ('user',)

        widgets = {

            'mobile1':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Mobile No 1'}),

            'mobile2':forms.TextInput(attrs={'class':'form-control', 'placeholder':'Mobile No 2'}),

            'occupation':forms.Select(choices=OCCUPATION_FIELD, attrs={'class':'form-control'}),

            'job_cader':forms.Select(choices=JOB_CADER, attrs={'class':'form-control'}),

            'profile':forms.ClearableFileInput(attrs={'class':'form-control'})

        }

on views.py
@login_required(login_url=’/backoffice/’)

def add_exco(request):

    if request.method == 'POST':

        register_form = RegisterForm(request.POST)

        extend_form = UserProfileForm(request.POST, request.FILES)

        if register_form.is_valid() and extend_form.is_valid():

            form1 = register_form.save()

            form2 = extend_form.save(commit=False)

            form2.user = form1

            form2.save()

            messages.success(request, 'An Exco have been registered successfully')

            register_form = RegisterForm()

            extend_form = UserProfileForm(request.POST, request.FILES)

    else:

        register_form = RegisterForm()

        extend_form = UserProfileForm()

    return render(request, 'dashboard/add-exco.html', {'reg':register_form, 'ext':extend_form})

Did you add signals to your Additional profile model

@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)

@receiver(post_save, sender=User)
def save_user_profile(sender, instance, **kwargs):
instance.profile.save()