Developer: Gustaaf Milzink
This repository contains the Django REST Framework API for the xPress front-end application.
The projects back-end section is focussed on it's administrative functionality and adresses a single user story:
- As site admin , I want to be able to create, edit and delete Users, Posts and Comments, so that I can have full control over the sites content.
The following models were created to represent the database model structure of the application:
Contains information about the user. Part of the Django allauth library.
- OneToOne relation with Profile model "owner" field.
- ForeignKey relation with Follower model "owner" field.
- ForeigKey relation with Follower model "followed" field.
- ForeignKey relation with Post model "owner" field.
- ForeignKey relation with Comment model "owner" field.
- ForeignKey relation with Like model "owner" field.
Contains the following fields:
"owner", "name", "avatar", "bio", "created_on" and "updated_on".
- OneToOne relation between "owner" field and User model "ID" field.
Contains the following fields:
"owner", "followed" and "created_on".
- ForeignKey relation between "owner" field and User model "ID" field.
- ForeignKey relation between "followed" field and User model "ID" field.
Contains the following fields:
"owner", "title", "incclude_text", "text", "excerpt", "include_image", "image", "include_audio", "audio", "published", "created_on" and "updated_on".
- ForeignKey relation between "owner" field and User model "ID" field.
Contains the following fields:
"owner", "post", "text", "created_on" and "updated_on".
- ForeignKey relation between "owner" field and User model "ID" field.
- ForeignKey relation between "post" field and Post model "ID" field.
Contains the following fields:
"owner", "post" and "created_on".
- ForeignKey relation between "owner" field and User model "ID" field.
- ForeignKey relation between "post" field and Post model "ID" field.
Back to top
- Python
- Django
- Git - Version control system. Used for version control and pushing code to GitHub.
- GitHub - Cloud based hosting service. Used as remote repository to store project code.
- Gitpod - Cloud based development environment. Used to host a virtual workspace.
- Django REST Framework - API toolkit. Used this to build the back-end API.
- Django AllAuth - API Module. Used for user authentication.
- Psycopg2 - PostgreSQL database adaptor. Used as a PostgreSQL database adapter for Python
- Cloudinary - Online file storage. Used to store all images and audio files.
- ElephantSQL - Database hosting service. Deployed project uses an ElephantSQL database.
- Lucid - Web-based diagramming application. Used to create database schema.
Back to top
During development all Python code has been continuously checked for warings and error using Pycodestyle No errors were reported in the final code.
The following tests were carried out on the app:
- Manual testing of user stories
- Automated testing
- As site admin , I want to be able to create, edit and delete Users, Posts and Comments, so that I can have full control over the sites content.
Test | Action | Expected Result | Actual Result |
---|---|---|---|
User | Create, update & delete user | A user can be created, edited or deleted | Works as expected |
Profile | Create, update & delete | User profile can be created, edited or deleted | Works as expected |
Post | Create, update & delete | A post can be created, edited or deleted | Works as expected |
Comment | Create, update & delete | A comment can be created, edited or deleted | Works as expected |
Automated testing was done using the Django Rest Framework APITestCase.
- Tests summary
Back to top
This project was created based on the Code Institute's Django REST API walkthrough project 'Moments'. Extra functionality was added such as: Creating a draft post, the ability to post audio, the ability to exclude specific post components from publication while storing them inside the post.