Skip to content

ahmedwaelsalah/CodeAlpha_EventRegistrationSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeAlpha Event Registration System

A beginner-friendly Django backend API for managing events and attendee registrations. This project was built for CodeAlpha Backend Development Task 2.

Tech Stack

  • Python
  • Django
  • Django REST Framework
  • SQLite
  • pytest
  • pytest-django
  • Django Admin

Setup

Create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate

Install dependencies:

python -m pip install -r requirements.txt

Apply database migrations:

python manage.py migrate

Run the Server

python manage.py runserver

The API will be available at:

http://127.0.0.1:8000/
http://127.0.0.1:8000/api/

Run Tests

pytest

API Endpoints

Method Endpoint Description
GET / API overview with project links
GET /api/health/ Check that the API is running
GET /api/events/ List events
GET /api/events/<id>/ Get event details
POST /api/registrations/ Public registration for an event
GET /api/registrations/ List registrations (staff/admin only)
GET /api/registrations/<id>/ Get registration details (staff/admin only)
DELETE /api/registrations/<id>/ Cancel a registration (staff/admin only)

Registration Rules

  • full_name, email, and event are required.
  • The event must exist.
  • Event end_time must be after start_time.
  • The same email cannot have more than one active registration for the same event.
  • Registration is blocked when the event capacity is full.
  • Deleting a registration changes its status to cancelled; it does not remove the row from the database.
  • Registration creation is public. Listing, viewing, and cancelling registrations require a staff/admin user.

Sample Curl Commands

API overview:

curl http://127.0.0.1:8000/

Health check:

curl http://127.0.0.1:8000/api/health/

List events:

curl http://127.0.0.1:8000/api/events/

Get one event:

curl http://127.0.0.1:8000/api/events/1/

Create a registration:

curl -X POST http://127.0.0.1:8000/api/registrations/ \
  -H "Content-Type: application/json" \
  -d '{"event": 1, "full_name": "Mona Ali", "email": "mona@example.com"}'

List registrations (requires staff/admin authentication):

curl http://127.0.0.1:8000/api/registrations/

Get one registration (requires staff/admin authentication):

curl http://127.0.0.1:8000/api/registrations/1/

Cancel a registration (requires staff/admin authentication):

curl -X DELETE http://127.0.0.1:8000/api/registrations/1/

Optional Feature: Django Admin Panel for Event Organizers

The project includes a Django Admin panel so event organizers can manage the system without a custom frontend.

Create an admin user:

python manage.py createsuperuser

Start the development server:

python manage.py runserver

Open the admin panel:

http://127.0.0.1:8000/admin/

Organizers can use the admin panel to:

  • Create and edit events.
  • View attendee registrations.
  • Search and filter events and registrations.
  • Cancel selected registrations using the admin action.

Admin validation also shows friendly errors for duplicate active registrations and full events.

About

Django REST API for event registration with admin panel, attendee registration, cancellation, validation, and tests.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages