Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Muhammadbugaje/trustride/llms.txt

Use this file to discover all available pages before exploring further.

The TrustRide admin panel is a custom operations interface built specifically for platform operators. It is separate from Django’s default /admin/ interface and provides purpose-built tools for managing users, trips, bookings, refunds, payouts, and platform-wide settings — all from a single dashboard at /control/.

Accessing the Admin Panel

The custom admin panel lives at /control/. It is not the same as Django’s built-in admin at /admin/. Access to any page under /control/ is protected by the @admin_required decorator, which checks that the logged-in user satisfies at least one of the following conditions:
  • is_staff = True
  • is_superuser = True
  • role = "admin" on the User model
Users who do not meet these criteria are redirected to the main site with an "Admin access only." error message. Unauthenticated visitors are sent to the login page.
# apps/admin_panel/decorators.py
def admin_required(view_func):
    @wraps(view_func)
    def wrapper(request, *args, **kwargs):
        if not request.user.is_authenticated:
            return redirect('users:login')
        if not (request.user.is_staff or request.user.is_superuser
                or getattr(request.user, 'role', None) == 'admin'):
            messages.error(request, 'Admin access only.')
            return redirect('rides:home')
        return view_func(request, *args, **kwargs)
    return wrapper

Dashboard Overview

The root of the admin panel (GET /control/) renders the operations overview. It aggregates the following live statistics from the database and displays them on the dashboard:
MetricDescription
Total UsersCount of all registered accounts
Total RidersUsers with role = "rider"
Total DriversUsers with role = "driver"
Active TripsTrips with status published or in_progress
Total BookingsAll bookings across every trip
Confirmed BookingsBookings currently in confirmed state
Total RevenueSum of price for all confirmed and completed bookings
Pending RefundsRefund requests with status requested
Pending VerificationsUnverified, non-suspended drivers awaiting approval
Suspended UsersAccounts with is_suspended = True
Pending ReportsDriver reports in pending status
The overview also surfaces recent activity panels: the eight most recent bookings, the five most recent refund requests, and the five most recently joined users. Two seven-day trend charts — user growth and revenue — are rendered from aggregated daily counts. All major admin functions are accessible from the sidebar. The sections below link to their dedicated documentation pages.

User Management & Verification

List all users, filter by role or status, verify or unverify drivers, suspend and reinstate accounts, and change user roles.

Payout Management

Create driver payout records, track commission rates, calculate net amounts, and manage the payout status lifecycle.

Reports & Exports

View platform-wide analytics, export booking and revenue CSVs, review driver reports, and inspect the audit log.

Trip Management

Cancel trips, force-complete in-progress trips, change trip status, and toggle trip visibility.

Booking Management

Browse all bookings with filters, cancel any booking as an admin, and view full booking detail including chat history.

Refund Processing

Approve or reject rider refund requests, add admin notes, and trigger automated email notifications.

Platform Settings

Configure platform fee, refund window, booking expiry, bank details, social media links, and feature flags.

Ambassador Management

Review ambassador applications, approve or reject applicants, manage active ambassadors, and update commission rates.

Trip Operations

Admins have full control over the lifecycle of any trip on the platform.

Viewing Trips

GET /control/trips/ lists all trips, ordered by departure date. Trips can be filtered by status and searched by origin, destination, or driver name. The paginated list shows 20 trips per page. GET /control/trips/<uuid>/ shows full trip detail, including all bookings (with rider names and seat IDs) and any waitlist entries.

Cancelling a Trip

POST /control/trips/<uuid>/cancel/ Cancels the trip by setting status = "cancelled" and is_active = False. All active bookings (reserved, pending_verification, confirmed) receive a system message in their booking chat notifying the rider of the cancellation. An optional reason POST parameter is included in the message. The action is written to the audit log.

Force-Completing a Trip

POST /control/trips/<uuid>/force-complete/ Sets status = "completed" on the trip and bulk-updates all confirmed bookings to completed. Use this when a trip has concluded but the driver has not marked it complete.

Changing Trip Status

POST /control/trips/<uuid>/change-status/ Allows setting any valid status from Trip.STATUS_CHOICES:
Statusis_active set to
draftTrue
publishedTrue
in_progressTrue
cancelledFalse
completedFalse
expiredUnchanged

Toggling Trip Active State

POST /control/trips/<uuid>/toggle-active/ Flips is_active between True and False without changing the status. Useful for temporarily hiding a trip from search results.

Booking Operations

Viewing Bookings

GET /control/bookings/ lists all bookings across all trips, filterable by status and searchable by rider name, origin, or destination. 25 bookings are shown per page. GET /control/bookings/<uuid>/ shows a full booking record, including the complete in-booking chat message thread and any associated refund requests.

Cancelling a Booking

POST /control/bookings/<uuid>/cancel/ Cancels the booking on behalf of the platform. This endpoint will reject cancellations for bookings already in completed, refunded, cancelled, or expired states. On success:
  1. Booking status is set to cancelled.
  2. One available seat is returned to the trip (capped at total_seats).
  3. A system chat message is sent to the rider with the cancellation reason.
  4. The next rider on the trip’s waitlist is notified.
  5. The action is recorded in the audit log.

Refund Processing

GET /control/refunds/ lists all refund requests. The page header displays total counts for pending, approved, and rejected refunds. Results can be filtered by status.

Approving a Refund

POST /control/refunds/<uuid>/approve/ Sets the refund to approved, returns one seat to the trip, deletes the associated booking, and sends a refund approval email to the rider. An optional notes POST parameter is saved as admin_notes on the refund record. The admin’s user account is attached to the refund for audit purposes.

Rejecting a Refund

POST /control/refunds/<uuid>/reject/ Sets the refund to rejected and sends a rejection email to the rider that includes the admin’s notes. The booking is not modified.
Both approve and reject endpoints support HTMX partial responses. If the request carries an HX-Request header, the server returns only the updated refund row HTML instead of a full redirect.

Platform Settings

GET /control/settings/ renders the settings panel. Settings are stored as AppSetting key-value records. POST /control/settings/save/ persists changes. Only settings whose values have changed are written to the database; unchanged settings are skipped. The save view logs all changed setting labels to the audit log. The following settings are managed from this panel:
KeyDescriptionDefault
platform_fee_percentPlatform fee percentage5
refund_window_daysDays within which a refund can be requested7
payment_destinationRoute payments to admin accounttrue
admin_bank_nameAdmin bank name
admin_bank_account_nameAdmin account holder name
admin_bank_account_numberAdmin account number
booking_expiry_minutesMinutes before an unpaid reservation expires30
waitlist_claim_minutesMinutes a waitlisted rider has to claim a seat15
admin_whatsappSupport WhatsApp number+2348000000000
admin_emailSupport emailsupport@trustride.ng
admin_phoneSupport phone+2348000000000
instagram_urlInstagram page URL
twitter_urlTwitter / X page URL
telegram_urlTelegram channel URL
facebook_urlFacebook page URL
waitlist_enabledEnable the trip waitlist featuretrue
dynamic_pricing_enabledEnable per-stop dynamic pricingfalse
driver_verification_requiredRequire admin verification before drivers publish tripstrue

Ambassador Management

TrustRide supports a network of field ambassadors who can book seats on behalf of riders. The admin panel provides a full suite of tools to manage this programme.

Applications

GET /control/ambassador/applications/ lists all ambassador applications with their current status (pending, approved, rejected). GET /control/ambassador/applications/<id>/ shows the full application detail, including the applicant’s stated reason and location. POST /control/ambassador/applications/<id>/approve/ promotes the user to ambassador by setting is_ambassador = True, recording ambassador_approved_at and ambassador_approved_by on their account, and marking the application as approved. POST /control/ambassador/applications/<id>/reject/ marks the application as rejected and saves optional admin_notes.

Active Ambassador Management

GET /control/ambassador/management/ lists all active ambassadors, filterable by ambassador_status (active, paused, revoked) and searchable by name or email. POST /control/ambassador/<id>/toggle-pause/ toggles an ambassador between active and paused states. POST /control/ambassador/<id>/revoke/ permanently revokes ambassador status, sets is_ambassador = False, and records who performed the action and when. POST /control/ambassador/<id>/update-commission/ updates the ambassador’s ambassador_commission_rate (must be between 0 and 100).

Build docs developers (and LLMs) love