A simple Django-based web application that allows users to add and view contacts with ease.
This mini project is ideal for beginners learning Django and covers models, views, forms, and templates.
- β Add new contacts (name, phone number, email)
- β View all saved contacts in a list
- β Form validation with error handling
- β Redirects on success
- β Clean and simple interface
- Backend: Python 3.x, Django 4.x
- Database: SQLite (default with Django)
- Frontend: HTML5, CSS3 (Django templates)
contacts_project/ βββ contacts/ # Django app β βββ migrations/ β βββ templates/ β β βββ contacts/ β β βββ add_contact.html β β βββ view_contacts.html β βββ admin.py β βββ apps.py β βββ forms.py # Django form for contact β βββ models.py # Contact model β βββ tests.py β βββ views.py # Handles add/view contact logic βββ contacts_project/ β βββ init.py β βββ asgi.py β βββ settings.py β βββ urls.py # Project URL configuration β βββ wsgi.py βββ db.sqlite3 # SQLite database βββ manage.py βββ README.md
Contact Model
class Contact(models.Model):
name = models.CharField(max_length=100)
phone = models.CharField(max_length=15)
email = models.EmailField()
def __str__(self):
return self.name
Templates
add_contact.html β Form page
view_contacts.html β Displays list of contacts