This Django project allows users to upload images as badges. Each badge is a circular avatar that adheres to specific criteria: it must be 512x512 pixels, contain only non-transparent pixels within a circular area, and feature colors that convey a "happy" feeling. The project includes functionality to validate and automatically adjust uploaded images to meet these criteria.
- Image Upload: Users can upload images to be used as badges.
- Automatic Adjustment: Images are automatically resized to 512x512 pixels and cropped to a circular shape with a transparent background.
- Color Validation: The colors of the badge are analyzed to ensure they give off a "happy" feeling. Images are adjusted to meet this criterion if necessary.
- Admin Interface: Admins can manage uploaded images through the Django admin interface.
- Python 3.8 or higher
- Django 3.2 or higher
- Pillow library for image processing
- Clone the repository:
git clone https://github.com/SNAYZZ72/TechAssignement.git cd TechAssignmentBadge
- Install the required packages:
pip install -r requirements.txt
- Apply migrations:
python manage.py migrate
- Create a superuser:
python manage.py createsuperuser
- Run the server:
python manage.py runserver
- Open the application in your web browser:
http://localhost:8000/
- Access the admin interface:
Use the superuser credentials created in step 4 to log in.
http://localhost:8000/admin/
The project is structured as follows:
The project is structured as follows:
TechAssignmentBadge/
: Main project directory.settings.py
: Contains project settings.urls.py
: Defines project URL configurations.
imageUploads/
: Application directory for image uploads.models.py
: Defines theImage
model.views.py
: Handles requests and responses for image uploading.forms.py
: Contains the form for image upload, including validation and adjustment logic.admin.py
: Configuration for the Django admin interface.urls.py
: URL configurations for theimageUploads
app.
templates/
: Directory for HTML templates used by the application.images/
: Directory where uploaded images are stored (configured insettings.py
).migrations/
: Contains database migrations for theimageUploads
app.
This structure ensures a clear separation of concerns, with the imageUploads
app handling all aspects related to image processing and upload functionality.
To upload an image, navigate to the home page and click the "Upload Image" button. Select an image file from your computer and click "Upload" to submit the form. The image will be processed and displayed on the page.
The admin interface can be accessed at http://localhost:8000/admin/
. Log in with the superuser credentials created during installation. From the admin interface, you can view, add, edit, and delete images.
This project was created as part of a technical assignment for a job application. The original requirements and specifications were provided by the employer.
For any questions or feedback, feel free to contact me at [email protected].
# Path: requirements.txt
asgiref==3.7.2
Django==5.0.2
pillow==10.2.0
sqlparse==0.4.4
tzdata==2024.1