2.2 KiB
2.2 KiB
About Us API
This Django app provides API endpoints for managing about us page content.
Models
AboutBanner
- Main banner section with title, description, badge, CTA button, and image
- Related models: AboutStat, AboutSocialLink
AboutService
- Service section with company information and features
- Related models: AboutFeature
AboutProcess
- Development process section with methodology and steps
- Related models: AboutProcessStep
AboutJourney
- Company journey section with milestones
- Related models: AboutMilestone
API Endpoints
Combined Endpoint
GET /api/about/page/- Get all about page data in one request
Individual Endpoints
Banner
GET /api/about/banner/- List all active bannersGET /api/about/banner/{id}/- Get specific banner
Service
GET /api/about/service/- List all active servicesGET /api/about/service/{id}/- Get specific service
Process
GET /api/about/process/- List all active processesGET /api/about/process/{id}/- Get specific process
Journey
GET /api/about/journey/- List all active journeysGET /api/about/journey/{id}/- Get specific journey
Management Commands
Populate Sample Data
python manage.py populate_about_data
This command creates sample data for all about us sections.
Frontend Integration
The frontend uses the following files:
lib/api/aboutService.ts- API service for fetching datalib/hooks/useAbout.ts- React hooks for data management- Components in
components/pages/about/- Updated to use API data
Usage Example
import { useAbout } from '@/lib/hooks/useAbout';
const AboutPage = () => {
const { data, loading, error } = useAbout();
if (loading) return <div>Loading...</div>;
if (error) return <div>Error: {error}</div>;
return (
<div>
<h1>{data?.banner.title}</h1>
<p>{data?.banner.description}</p>
{/* Render other sections */}
</div>
);
};
Admin Interface
All models are available in the Django admin interface for easy content management:
- Navigate to
/admin/after creating a superuser - Manage about us content through the admin interface
- Upload images and manage relationships between models