A hypothetical CMS Implementation using Django and VueJS
Please have a look at all the libraries listed under package.json
Thanks these blogs for helping me out: https://jasonwatmore.com/post/2018/07/14/vue-vuex-user-registration-and-login-tutorial-example#auth-header-js
https://www.pydanny.com/drf-jwt-axios-vue.html
https://scotch.io/tutorials/handling-authentication-in-vue-using-vuex
https://hackernoon.com/jwt-authentication-in-vue-js-and-django-rest-framework-part-1-c40c5c0d4f6e
and answers on Stackoverflow
VueJS's default logo is used for demo purposes
Front-end consists of a VueJS 2 application that has its boilerplate from vue-cli and depends on bootstrap for UI.
The application is secured by JWT and role mechanism though it might be improved.
To start the application please run: npm install npm run serve
and see that it starts on 8080
Please install the following libraries for the backend to work:
pip install django # we need django version 2 or higher
pip install djangorestframework
pip install django-cors-headers
pip install djangorestframework-jwt
pip install rest_framework_jwt
pip install django-cors-header
pip install django-filter
cd backend (where manage.py is located)
run the following: python manage.py makemigrations python manage.py migrate
This step is important to create an admin user. Email and password will be used during login on frontend: python manage.py createsuperuser
If you want to change it into a MySQL db please change DATABASES obj in settings.py: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'DB_NAME', 'USER': 'DB_USER', 'PASSWORD': 'DB_PASSWORD', 'HOST': 'localhost', # Or an IP Address that your DB is hosted on 'PORT': '3306', } }
Then run makemigrations and migrate commands again as in the previous step.
and run: python manage.py runserver 8081
Add jest tests and backend tests to improve Make components for some duplicate tables
In case of inability to run the program or fail to understand the flow, contact me and review below screenshots please:
- Login with admin user that you have created during backend setup
- You will see empty tables
- Go to back to register link on initial login view by logging out
- Register users for employee and employer (no roles specified here as if they register themselves)
- Login as admin again
- You will see the users in the table
- Edit them and assign roles (put password as well - known bug)
- As admin you can create employers or employees as well as a user with employer role - the system role.
- The difference is that a user can have multiple employment as history - not implemented - This is why the concepts are separated here
- In Manage Employers, register employers
- In Manage Employees, register employees
- When registering employees you will select the employer, this is why we need to remember registering employees first
- Logout and login as an employer
- Manage employees show employees for the employer - shows all for now
- Manage tasks view, there an employer can assign a task to an employee
- Logout and login as employee
- In Manage Tasks view, see all tasks and change their status: eg. TODO, IN PROGRESS, DONE
I know the flow can be extended such as historical employement etc. as in a HR or CMS application
Please feel free to contact