Django redirect url not functioning as expected

So I am making a simple django project where me as a superuser, I can make restaurant instances and it will make a landing page for each restaurant. I have two admin panels, one is the main one, which is for superuser and the other is for restaurant owners who have the is_restaurant_admin set to true. Now the problem is, after stripe onboarding when I make a restaurant instance from admin panel, it redirects me to http://127.0.0.1:8000/restaurant-admin/login/?next=/restaurant-admin/%3Fstripe_onboarding_completed%3Dtrue even though I explicitly wrote the logic to redirect me to main admin page. Can anyone point out where the problem is please? Thanks!

My models.py:

class Restaurant(models.Model):
    name = models.CharField(max_length=100)
    email = models.EmailField()
    description = models.TextField()
    image = models.ImageField(upload_to='restaurant_images/')
    banner_image = models.ImageField(upload_to='restaurant_images/', null=True)
    primary_color = models.CharField(max_length=7)  # Hex color code
    secondary_color = models.CharField(max_length=7)  # Hex color code
    favicon = models.FileField(upload_to='restaurant_favicons/', null=True, blank=True)
    about_text = models.TextField(blank=True, null=True)
    map_iframe_src = models.TextField(blank=True, null=True)
    slug = models.SlugField(unique=True, max_length=100, null=True)
    stripe_account_id = models.CharField(max_length=255, null=True, blank=True)
    stripe_account_completed = models.BooleanField(default=False)

    def save(self, *args, **kwargs):
        if not self.slug:
            self.slug = slugify(self.name)
        super().save(*args, **kwargs)

    def __str__(self):
        return self.name

class RestaurantUser(AbstractUser):
    restaurant = models.OneToOneField(Restaurant, on_delete=models.CASCADE, null=True, blank=True)
    is_restaurant_admin = models.BooleanField(default=False)

    def save(self, *args, **kwargs):
        if self.is_restaurant_admin:
            self.is_staff = True
        super().save(*args, **kwargs)

My admin.py:

class RestaurantAdmin(admin.ModelAdmin):
    list_display = ('name', 'description', 'stripe_account_id', 'stripe_account_completed')
    search_fields = ('name', 'description')

    def save_model(self, request, obj, form, change):
        if not obj.stripe_account_id:
            account = stripe.Account.create(
                type="express",
                country="AU",
                email=obj.email,
                capabilities={"card_payments": {"requested": True}, "transfers": {"requested": True}},
            )
            obj.stripe_account_id = account.id
        super().save_model(request, obj, form, change)

    def redirect_to_stripe_onboarding(self, request, obj):
        account_link = stripe.AccountLink.create(
            account=obj.stripe_account_id,
            refresh_url=request.build_absolute_uri(reverse('admin:index')),
            return_url=request.build_absolute_uri(reverse('admin:index') + '?stripe_onboarding_completed=true'),
            type='account_onboarding',
        )
        return redirect(account_link.url)

    def response_add(self, request, obj, post_url_continue=None):
        if obj.stripe_account_id and not obj.stripe_account_completed:
            return self.redirect_to_stripe_onboarding(request, obj)
        return super().response_add(request, obj, post_url_continue)

    def response_change(self, request, obj):
        if 'stripe_onboarding_completed' in request.GET:
            obj.stripe_account_completed = True
            obj.save()
            messages.success(request, 'Stripe onboarding completed successfully!')
            return redirect('admin:index')
        
        if obj.stripe_account_id and not obj.stripe_account_completed:
            return self.redirect_to_stripe_onboarding(request, obj)
        
        return super().response_change(request, obj)

My admin_sites.py:

from django.contrib.admin import AdminSite
from django.contrib import admin
from .models import (
    RestaurantUser, Order, Restaurant, Menu, MenuItem, OrderItem, Topping, Side, Drink, Addon, MenuItemOption, MenuItemSize
)
from django.utils.html import format_html

class RestaurantAdminSite(AdminSite):
    site_header = "Restaurant Admin"
    site_title = "Restaurant Admin Portal"
    index_title = "Welcome to Restaurant Admin Portal"

    def has_permission(self, request):
        return request.user.is_active and request.user.is_restaurant_admin

restaurant_admin_site = RestaurantAdminSite(name='restaurant_admin')

My app urls.py:

from django.urls import path
from . import views
from .admin import main_admin_site
from .admin_sites import restaurant_admin_site

urlpatterns = [
    path('', views.home, name="home"),
    path('restaurant/<slug:restaurant_slug>/', views.restaurant_landing_page, name='restaurant_landing_page'),
    path('get-menu-item-details/<int:item_id>/', views.get_menu_item_details, name='get_menu_item_details'),
    path('create-order/', views.create_order, name='create_order'),
    path('accounts/login/', views.UserLoginView.as_view(), name='login'),
    path('accounts/register/', views.register, name='register'),
    path('accounts/owner-login/', views.OwnerLoginView.as_view(), name='owner_login'),
    path('accounts/logout/', views.UserLogoutView.as_view(), name='logout'),
    path('accounts/owner-logout/', views.OwnerLogoutView.as_view(), name='owner_logout'),
    path('admin/', main_admin_site.urls),
    path('restaurant-admin/', restaurant_admin_site.urls),
    path('restaurant-admins/dashboard/', views.restaurant_admin_dashboard, name='restaurant_admin_dashboard'),
    path('restaurant-admins/manage-menu-items/', views.manage_menu_items, name='manage_menu_items'),
    path('restaurant-admins/manage-orders/', views.manage_orders, name='manage_orders'),
]

My main urls.py:

from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('', include('restaurant.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Could you please explain the user cases here? Are you logging in as Superuser and wants to create a new restaurant, make payment and login automatically as owner?

So I am logged in as a superuser in the main admin page, not making payment, when I create a restaurant instance, I am redirected to Stripe onboarding page through Stripe Connect, and there after filling out the Stripe connect details for the restaurant, I should be redirected back to main admin page, but instead I am being redirected to the restaurant-admin page.

return_url=request.build_absolute_uri(reverse('admin:index') + '?stripe_onboarding_completed=true'),

Seems like this line can be the root cause.

Could you please install this package - GitHub - django-extensions/django-extensions: This is a repository for collecting global custom management extensions for the Django Framework..
Then try python manage.py show_urls to see what exactly the path /restaurant-admin/ name.