I made a program where users can keep track of their expenses by entering them into the system after creating their own account. The system requires users to fill in four fields: customer, category, price, and month. I would like the first field (customer) to automatically populate with the username of the logged-in user, so that users don't have to choose from all available customers.
However, I encountered an issue where users are unable to create objects in the system. I can only create objects through the admin dashboard. When I try to create an object on the page, it throws an error message saying,
RelatedObjectDoesNotExist at / User has no customer.

I suspect this problem is related to the fact that users are added in the authentication and authorization section under Users in the admin page, instead of being created under Customers by my app, alongside the Finance section where the objects are stored.
To summarize my two main issues:

I want the first field to automatically populate with the username of the logged-in user.
I want users to be able to create objects directly from the page, as they could in the past when this issue didn't occur.

Thank you so much for your help.
models.py:
class Customer(models.Model):
    user = models.OneToOneField(User, null=True, on_delete=models.CASCADE)
    name = models.CharField(max_length=200, null=True)
    email = models.CharField(max_length=200, null=True, blank=True)
    date_created = models.DateTimeField(auto_now_add=True, null=True)

    # def __str__(self):
    #     return self.name #I don't now if it's correct


class Finance(models.Model):
    expenses_category = [
        ("Saving", "Saving"),
        ("Food", "Food"),
        ("Bills", "Bills"),
        ("Rent", "Rent"),
        ("Extra", "Extra"),
    ]

    expenses_month = [
        ("January", "January"),
        ("February", "February"),
        ("March", "March"),
        ("April", "April"),
        ("May", "May"),
        ("June", "June"),
        ("July", "July"),
        ("August", "August"),
        ("September", "September"),
        ("October", "October"),
        ("November", "November"),
        ("December", "December"),
    ]

    customer = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
    category = models.CharField(choices=expenses_category, max_length=200)
    price = models.IntegerField()
    month = models.CharField(choices=expenses_month, max_length=200)


views.py:
@csrf_exempt
def registerPage(request):
    if request.user.is_authenticated:
        return redirect('home')
    else:
        form = CreateUserForm()
        if request.method == 'POST':
            form = CreateUserForm(request.POST)
            if form.is_valid():
                # form.instance.user = request.user
                user = form.save()
                username = form.cleaned_data.get('username')

                group = Group.objects.get(name='customer')
                user.groups.add(group)

                messages.success(request, 'Account was created for ' + username)

                return redirect('login')

        context = {'form': form}
        return render(request, 'app_finance/register.html', context)


def loginPage(request):
    username = None
    if request.user.is_authenticated:
        username = request.user.customer
        return redirect('home')
    else:
        if request.method == 'POST':
            username = request.POST.get('username')
            password = request.POST.get('password')

            user = authenticate(request, username=username, password=password)

            if user is not None:
                login(request, user)
                return redirect('home')
            else:
                messages.info(request, 'Username or password incorrect.')

        context = {}
        return render(request, 'app_finance/login.html', context)


def logoutUser(request):
    logout(request)
    return redirect('login')


def userPage(request):
    return render(request, 'app_finance/user.html')


@login_required(login_url='login')
def homeView(request):
    # customer = Customer.objects.get(id=pk) (not sure#)
    username = None
    items = Finance.objects.filter(customer_id=request.user.id)
    form = FinanceForm(initial={'customer': User})
    if request.method == 'POST':
        username = request.user.customer
        form = FinanceForm(request.POST)  # initial={'customer': user}
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/')
    else:
        form = FinanceForm()
        return render(request, 'app_finance/home.html', {'form': form, 'items': items})


forms.py:
class CustomerForm(ModelForm):
    class Meta:
        model = Customer
        fields = '__all__'
        exclude = ['user']


class CreateUserForm(UserCreationForm):
    class Meta:
        model = User
        fields = ['username', 'email', 'password1', 'password2']


class FinanceForm(ModelForm):
    class Meta:
        model = Finance
        fields = '__all__'


templates/home.html:
<div>
    <span>Hello, {{ request.user }}</span> <br>
    <span><a class="hello-msg" href="{% url 'logout' %}">Logout</a></span>
</div>


<form action="" method="post">
    {% csrf_token %}
    {{ form }}
    <!-- {{ form }} -->

    <input type="submit" value="Submit">
</form>

<br>
<div class="row">
    <div class="col-md">
        <div class="card card-body">
            <h1>Expenses</h1>
        </div>
        <div class="card card-body">
            <table class="table">
                <tr>
                    <th>User</th>
                    <th>Category</th>
                    <th>Price</th>
                    <th>Month</th>
                </tr>
                {% for i in items %}
                    <tr>
                        <td>{{ i.customer }}</td>
                        <td>{{ i.category }}</td>
                        <td>{{ i.price }}</td>
                        <td>{{ i.month }}</td>
                        <td>&nbsp;&nbsp;</td>
                        <td><a class="btn btn-sm btn-info" href="">Update</a></td>
                        <td><a class="btn btn-sm btn-danger" href="">Delete</a></td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </div>
</div>


Thanks again for helping.

User can't create objects in the page
This is the solution i found and worked perfect too.
I made 2 changes:

views.py:

    @login_required(login_url='login')
def homeView(request):
    items = Finance.objects.filter(customer=request.user).order_by(Cast('month', IntegerField())).reverse()

    if request.method == 'POST':
        form = FinanceForm(request.POST, request=request)  # Pass the request object to the form
        if form.is_valid():
            finance_obj = form.save(commit=False)
            finance_obj.customer = request.user
            finance_obj.save()
            return redirect('home')
    else:
        form = FinanceForm(request=request)  # Pass the request object to the form

    context = {'form': form, 'items': items}
    return render(request, 'app_finance/home.html', context)


forms.py

    class FinanceForm(ModelForm):
    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request')  # Retrieve the request object
        super().__init__(*args, **kwargs)
        self.fields['customer'].initial = self.request.user

