{"id":19933329,"url":"https://github.com/mishaa931/multi-attachments-in-django-rest-framework","last_synced_at":"2026-05-06T11:34:04.010Z","repository":{"id":254987992,"uuid":"848181723","full_name":"Mishaa931/Multi-Attachments-in-Django-Rest-Framework","owner":"Mishaa931","description":"A Django project for managing leave applications with support for multiple file attachments. Includes features for creating, updating, importing, and exporting leave applications, along with file size validation to ensure attachments do not exceed 3 MB.","archived":false,"fork":false,"pushed_at":"2024-08-27T10:36:59.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T08:06:38.799Z","etag":null,"topics":["csv-to-models","data-upload","django","django-rest-framework","export-data-from-django-models-to-csv","file-size-validation","import-data-to-django-models","managment-command-django","models-to-csv","multiple-file-upload","pandas","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mishaa931.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-27T09:35:27.000Z","updated_at":"2024-08-28T06:01:13.000Z","dependencies_parsed_at":"2024-08-27T11:17:49.176Z","dependency_job_id":null,"html_url":"https://github.com/Mishaa931/Multi-Attachments-in-Django-Rest-Framework","commit_stats":null,"previous_names":["mishaa931/multi-attachments-in-django-rest-framework"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mishaa931/Multi-Attachments-in-Django-Rest-Framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mishaa931%2FMulti-Attachments-in-Django-Rest-Framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mishaa931%2FMulti-Attachments-in-Django-Rest-Framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mishaa931%2FMulti-Attachments-in-Django-Rest-Framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mishaa931%2FMulti-Attachments-in-Django-Rest-Framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mishaa931","download_url":"https://codeload.github.com/Mishaa931/Multi-Attachments-in-Django-Rest-Framework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mishaa931%2FMulti-Attachments-in-Django-Rest-Framework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32691921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv-to-models","data-upload","django","django-rest-framework","export-data-from-django-models-to-csv","file-size-validation","import-data-to-django-models","managment-command-django","models-to-csv","multiple-file-upload","pandas","python"],"created_at":"2024-11-12T23:13:28.080Z","updated_at":"2026-05-06T11:34:03.983Z","avatar_url":"https://github.com/Mishaa931.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Multi-Attachment Handling API with Import/Export\n\nThis Django project provides an API for managing leave applications with multiple file attachments.\n\n## Features\n- **Create Leave Application**: Apply for leave with multiple file attachments.\n- **Update Leave Application**: Update an existing leave application and replace its file attachments.\n- **File Size Validation**: Ensures uploaded files do not exceed the 3 MB limit.\n- **Import Data**: Import data from a CSV file into a Django model using a management command.\n- **Export Data**: Export data from a Django model to a CSV file.\n\n## Setup\n1. **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/Mishaa931/Multi-Attachments-in-Django-Rest-Framework/.git\n    cd Multi-Attachments-in-Django-Rest-Framework\n    ```\n\n2. **Install dependencies:**\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. **Run Migrations:**\n\n    ```bash\n    python manage.py migrate\n    ```\n\n## API Endpoints\n### Create Leave Application\n**Endpoint:** `POST /api/leave-apply/`\n\nUpload leave application details along with attachments.\n\n### Update Leave Application\n**Endpoint:** `PUT /api/leave-apply/{id}/`\n\nUpdate an existing leave application and replace its attachments.\n\n## File Size Validation\nThe project includes a custom file size validator validate_file_size in the LeaveAttachmentSerializer. It limits the file size to 3 MB (modifiable).\n\n## Example Payload\n    \n      {\n        \"from_date\": \"2024-08-27\",\n        \"to_date\": \"2024-08-29\",\n        \"apply_date\": \"2024-08-25T12:34:56Z\",\n        \"approved_date\": \"2024-08-26\",\n        \"report_back_date\": \"2024-08-30\",\n        \"attachment\": [\u003cfile1\u003e, \u003cfile2\u003e, ...]\n      }\n\n## How to Use\n\n1. **Run the Django server:**\n\n    ```bash\n    python manage.py runserver\n    ```\n\n2. **Test the API Endpoints:**\n\n   Use an API client like [Postman](https://www.postman.com/) to test the create and update endpoints for leave applications.\n   \n## Management Command\n\n### Import Data from CSV\n\n**Command:**\n\n    python manage.py import_data \u003capp_name\u003e \u003cmodel_name\u003e \u003cfile_path\u003e\n\nThe command reads data from the CSV file, processes it, and creates instances of the specified model.\n\n\nMemory updated\nHere’s the updated README with the new title and added import/export functionalities:\n\nmarkdown\nCopy code\n# Django Multi-Attachment Handling API with Import/Export\n\nA Django project for managing leave applications with support for multiple file attachments. Includes features for creating and updating leave applications, importing data from CSV files, and exporting data to CSV files. The project also includes file size validation to ensure attachments do not exceed 3 MB.\n\n## Features\n\n- **Create Leave Application**: Apply for leave with multiple file attachments.\n- **Update Leave Application**: Update an existing leave application and replace its file attachments.\n- **File Size Validation**: Ensures uploaded files do not exceed 3 MB.\n- **Import Data**: Import data from a CSV file into a Django model using a management command.\n- **Export Data**: Export data from a Django model to a CSV file.\n\n## Setup\n\n1. **Clone the repository:**\n\n    ```bash\n    git clone https://github.com/yourusername/your-repo.git\n    cd your-repo\n    ```\n\n2. **Install dependencies:**\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. **Run Migrations:**\n\n    ```bash\n    python manage.py migrate\n    ```\n\n## API Endpoints\n\n### Create Leave Application\n\n**Endpoint:** `POST /api/leave-apply/`\n\nUpload leave application details along with attachments.\n\n### Update Leave Application\n\n**Endpoint:** `PUT /api/leave-apply/{id}/`\n\nUpdate an existing leave application and replace its attachments.\n\n## Example Payload\n    {\n      \"from_date\": \"2024-08-27\",\n      \"to_date\": \"2024-08-29\",\n      \"apply_date\": \"2024-08-25T12:34:56Z\",\n      \"approved_date\": \"2024-08-26\",\n      \"report_back_date\": \"2024-08-30\",\n      \"attachment\": [\u003cfile1\u003e, \u003cfile2\u003e, ...]\n    }\n\n## Management Command \n### Import Data from CSV\n\n#### Command:\n\n    python manage.py import_data \u003capp_name\u003e \u003cmodel_name\u003e \u003cfile_path\u003e\n    \nThis command imports data from a CSV file into a specified Django model.\n\n**Arguments:**\n\n- `app_name`: The name of the Django app.\n- `model_name`: The name of the model.\n- `file_path`: The path to the CSV file.\n\n**Example:**\n\n    python manage.py import_data multiattachment1 LeaveApply /path/to/your/file.csv\n\n## Notes:\n\n* File size is limited to 3 MB per attachment.\n* The API returns the URLs of uploaded attachments in the response.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishaa931%2Fmulti-attachments-in-django-rest-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmishaa931%2Fmulti-attachments-in-django-rest-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmishaa931%2Fmulti-attachments-in-django-rest-framework/lists"}