Python should be installed
Open any newly created folder using vs code or any other IDE. folder name ex: event-schedular-python Go to terminal and follow below steps.
- First create virtual environment
python -m venv myenv
- To activate venv
.\myenv\Scripts\activate
- Install django
pip install django
- To create project
git clone https://github.com/imrosun/online-code-editor-python.git
OR
django-admin startproject event_scheduler
Skip if cloned
- To create app inside project
cd event_scheduler
python manage.py startapp api
After this add app {'codeeditor'} inside INSTALLED_APPS on settings.py file
- Create superuser for database if not created
python manage.py createsuperuser
- Not needed if you clone, this is used to see if there has been made changes and it migrates
python manage.py makemigrations
python manage.py migrate
AND
python manage.py makemigrations api # for api app
python manage.py migrate
- To run server
python manage.py runserver
- To host on vercel
Step 1: Go to /event_scheduler/settings.py - Update ALLOWED_HOSTS = ['.vercel.app']
-
- means all and specified .vercel.app ex: ['*', '.vercel.app']
Step 2: Generate requirments.txt using command
pip freeze > requirements.txt
Step 3: Create vercel.json file in app folder or manage.py path and copy the code
AUTHENTICATION
- Register
- POST /api/auth/register/
- example: http://127.0.0.1:8000/api/register/
- Body:
{
"username": "alice",
"email": "[email protected]",
"password": "password123"
}
- Response: Returns username and email.
- Login (JWT)
- POST /api/auth/login/
- Body:
{
"username": "alice",
"password": "password123"
}
- Response: Returns access_token: {access} and refresh_token: {refresh}. Use access as Bearer token for all further requests.
- Refresh Token
- POST /api/auth/refresh/
- Body:
{
"refresh": "<refresh_token>"
}
- Response: Returns refreshed access_token
- Logout
- POST /api/auth/logout/
- Headers: Authorization: Bearer <access_token>
- Body:
{
"refresh": "<refresh_token>"
}
- Response: Returns successful message
EVENT MANAGEMENT
- Create Event
- POST /api/events/
- Headers: Authorization: Bearer <access_token>
- Body:
{
"title": "Team Meeting",
"description": "Discuss project roadmap",
"start_time": "2025-05-24T10:00:00Z",
"end_time": "2025-05-24T11:00:00Z",
"location": "Conference Room",
"is_recurring": false,
"recurrence_pattern": ""
}
- Response: Returns success message
- List Events
- GET /api/events/
- Headers: Authorization: Bearer <access_token>
- Response: Returns all events associated with the access_token
- Get Specific Event
- GET /api/events/<event_id>/
- example: http://127.0.0.1:8000/api/events/1/
- Headers: Authorization: Bearer <access_token>
- Response: Returns particular event associated with the access_token
- Update Event
- PUT /api/events/<event_id>/
- Headers: Authorization: Bearer <access_token>
- Body: (any fields to update)
{
"title": "Updated Meeting",
"description": "Updated description"
}
- Response: Returns successfully updated message
- Delete Event
- DELETE /api/events/<event_id>/
- Headers: Authorization: Bearer <access_token>
- Response: Returns successfully deleted message
- Batch Create Events
- POST /api/events/batch/
- Headers: Authorization: Bearer <access_token>
- Body:
[
{
"title": "Event 1",
"description": "First event",
"start_time": "2025-05-24T12:00:00Z",
"end_time": "2025-05-24T13:00:00Z",
"location": "",
"is_recurring": false,
"recurrence_pattern": ""
},
{
"title": "Event 2",
"description": "Second event",
"start_time": "2025-05-25T12:00:00Z",
"end_time": "2025-05-25T13:00:00Z",
"location": "",
"is_recurring": false,
"recurrence_pattern": ""
}
]
- Response: Returns successfully event added message
COLLABORATION
- Share Event
- POST /api/events/<event_id>/share/
- Headers: Authorization: Bearer <access_token>
- Body:
{
"users": [
{"user_id": 2, "role": "editor"},
{"user_id": 3, "role": "viewer"}
]
}
- Response: Returns list along with role and user_id
- List Permissions
- GET /api/events/<event_id>/permissions/
- Headers: Authorization: Bearer <access_token>
- Response: Returns the permission role
- Update Permission
- PUT /api/events/<event_id>/permissions/<user_id>/
- Headers: Authorization: Bearer <access_token>
- Body:
{
"role": "editor"
}
- Response: Returns permission updated
- Remove Permission
- DELETE /api/events/<event_id>/permissions/<user_id>/
- Headers: Authorization: Bearer <access_token>
- Response: Returns permission removed
VERSION HISTORY
- Get Specific Version
- GET /api/events/<event_id>/history/<version_id>/
- Headers: Authorization: Bearer <access_token>
- Response: Returns version history
- Rollback to Version
- POST /api/events/<event_id>/rollback/<version_id>/
- Headers: Authorization: Bearer <access_token>
- Response: Returns rollback version
CHANGELOG AND DIFF
- Get Changelog
- GET /api/events/<event_id>/changelog/
- Headers: Authorization: Bearer <access_token>
- Response: Returns changlog
- Get Diff Between Versions
- GET /api/events/<event_id>/diff///
- Headers: Authorization: Bearer <access_token>
- Response: Returns version diff