# TEAMJOINT Company Limited Django Backend

This Django backend provides API endpoints for handling contact messages and image uploads from the TEAMJOINT Company Limited website.

## Features

- Contact message submission with image attachments
- Admin interface for staff to manage messages
- REST API endpoints for frontend integration
- Image upload handling with descriptions
- Email notifications for new messages
- Message status tracking and assignment

## Setup Instructions

### Windows
1. Run the setup script: `setup.bat`
2. Or follow manual steps below

### Manual Setup
1. Create virtual environment:
   ```bash
   python -m venv venv
   ```

2. Activate virtual environment:
   ```bash
   # Windows
   venv\Scripts\activate
   # Linux/Mac
   source venv/bin/activate
   ```

3. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

4. Run migrations:
   ```bash
   python manage.py makemigrations
   python manage.py migrate
   ```

5. Create superuser:
   ```bash
   python manage.py setup_admin
   ```

6. Start development server:
   ```bash
   python manage.py runserver
   ```

## API Endpoints

- `POST /api/contact/` - Submit contact message with images
- `GET /api/messages/` - List all messages (admin)
- `GET /api/messages/{id}/` - Get specific message details
- `PUT /api/messages/{id}/` - Update message status/notes

## Admin Interface

Access the admin interface at `http://127.0.0.1:8000/admin/`

Default credentials:
- Username: `admin`
- Password: `grizzly2024`

## Frontend Integration

The API accepts multipart form data for image uploads. Example usage:

```javascript
const formData = new FormData();
formData.append('name', 'John Doe');
formData.append('email', 'john@example.com');
formData.append('subject', 'Service Inquiry');
formData.append('message', 'Hello, I need help with...');
formData.append('uploaded_images', imageFile1);
formData.append('uploaded_images', imageFile2);
formData.append('image_descriptions', 'Description 1');
formData.append('image_descriptions', 'Description 2');

fetch('http://127.0.0.1:8000/api/contact/', {
  method: 'POST',
  body: formData,
});
```

## Configuration

Update the `.env` file with your specific settings:
- Email configuration for notifications
- Secret key for production
- Database settings (if not using SQLite)