Skip to content

gabrielgamis/CRUD-Python-Django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation


🚀 Django CRUD - Employee Management System

A complete CRUD system for employee management, built with Django, showcasing skills in Python, Django ORM, Templates, and Full-Stack Development.


🌐 Live Demo

Coming soon (add your deployment link here)


✨ Features

  • CREATE — Full employee registration
  • 📄 READ — Responsive table listing
  • ✏️ UPDATE — Edit with pre-filled form
  • DELETE — Remove with confirmation
  • 🔄 Data validation (numeric ID required)
  • 📱 Clean and intuitive interface
  • ⚡ SQLite database (zero configuration)

🛠️ Technologies Used

  • Python 3.14+
  • Django 6.0+
  • SQLite3
  • HTML5 / CSS3
  • Django Templates

📁 Project Structure

crud_operations/
├─ manage.py
├─ db.sqlite3
├─ employee/                 # Main app
│  ├─ models.py              # Employee model
│  ├─ views.py               # CRUD logic
│  ├─ urls.py                # App routes
│  └─ templates/
│     ├─ home.html           # Employee list
│     ├─ create.html         # Create form
│     └─ update.html         # Update form
├─ crud_operations/          # Project settings
│  └─ settings.py
└─ README.md

⚡ Getting Started

# 1. Navigate to project folder
cd crud_operations

# 2. Create virtual environment
python -m venv env

# 3. Activate virtual environment (Windows)
env\Scripts\Activate.ps1

# 4. Install dependencies
pip install django

# 5. Apply migrations
python manage.py makemigrations
python manage.py migrate

# 6. Run development server
python manage.py runserver

🔗 Open in your browser: 👉 http://127.0.0.1:8000/


🔗 Application Routes

Method Route Description
GET / List all employees
GET /create/ Create employee form
POST /create/ Save new employee
GET /update/1/ Edit employee (ID = 1)
POST /update/1/ Update employee
GET /delete/1/ Delete employee

💡 Technical Highlights

🔢 IntegerField Validation

emp_id = int(request.POST.get('emp_id'))

🔤 Case-Sensitive Templates

# views.py
return render(request, 'home.html', {'Employees': employees})
<!-- home.html -->
{% for x in Employees %}

⚠️ Error Handling

try:
    emp_id = int(emp_id_str)
except ValueError:
    return render(request, "update.html", {
        'error': 'ID must be a number!'
    })

🧰 Troubleshooting

Issue Solution
Not saving Use int(emp_id) in the view
Empty table Use Employees (capital E)
IDs start high Delete db.sqlite3 and migrate
Django not found Run pip install django

📫 Contact


⭐ Future Improvements

  • 🔐 User authentication (login/logout)
  • 🌐 Deployment (Render / Railway / Vercel)
  • 🎨 UI improvements with Bootstrap or Tailwind
  • 🔎 Search and filtering
  • 📊 Pagination

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors