Friday, November 21, 2025

Calorie Counter Sheet for Web Application Development with Python - Hasan Sir

 Job 1:
Develop a Calorie Counter Develop a Calorie Counter that can be used to estimate the number of calories a person needs to consume each day. This calculator can also provide some simple guidelines for gaining or losing weight. Users can also keep track of how many calories he/she needs and how much he/she consumes in a day. To calculate calories, we have two formulas: 

For a male
BMR= 66.47+(13.75 x weight in kg) + (5.003 x height in cm) - (6.755 x age in years)

For a female
BMR=655.1+(9.563 x weight in kg)+(1.850 xheight in cm) - (4.676 x age in years)

Job Specification information:
1. Create a new Django project named Name_ID_CaloryCounter and a Calorie Counter app. 
2. Define your Calorie Counter models. 
3. Create views for Login (username/email and password) and Registration (username, email, password, confirm password) pages. 
4. Create a django-form to take input Name, Age, Gender, Height, Weight etc. 
5. Create a Django form to take input daily consumed calories (Item name, Calorie consumed) 
6. Create a dashboard where the user can view the required calories for her/him and the consumed calories daily. 
7. Define URL Patterns and configure project-level URLs.
8. Implement the required Function and Logic in the view.py file.

Job Specification information: 
a. Create a new Django project. (Naming Convention: Name_ID_CaloryCounter) 
b. Run migration to create the data tables. 
c. Create a super user. (username: admin, password: 1234) 
d. Register your models to the Django admin.

settings.html
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-)r_t9^@ndevcfhqa7kn8a4m&i+mo6nmogt-fvv#+v%r4zd#3jj'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'calorie_counter',
    "crispy_forms",
    "crispy_bootstrap5",
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'Name_ID_CaloryCounter.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'Name_ID_CaloryCounter.wsgi.application'


# Database
# https://docs.djangoproject.com/en/5.2/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}


# Password validation
# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/5.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Asia/Dhaka'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.2/howto/static-files/

STATIC_URL = 'static/'
STATICFILES_DIRS = [BASE_DIR / 'Name_ID_CaloryCounter/static']
STATIC_ROOT = BASE_DIR / 'staticfiles'


MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / 'media'

# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap5"


LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = 'dashboard'
LOGOUT_REDIRECT_URL = 'login'


Requirement.txt
asgiref==3.11.0
crispy-bootstrap5==2025.6
Django==5.2.8
django-crispy-forms==2.5
sqlparse==0.5.3


Models.py
from django.db import models

class Profile(models.Model):
    CHOOSE_GENDER = [
        ("", "Select"),
        ("male", "Male"),
        ("female", "Female"),
    ]
    user = models.OneToOneField("auth.User", on_delete=models.CASCADE, related_name="user_profile")
    name = models.CharField(max_length=100)
    gender = models.CharField(choices=CHOOSE_GENDER, max_length=10, null=True, blank=True)
    age = models.PositiveIntegerField(null=True, blank=True)
    weight = models.FloatField(null=True, blank=True)
    height = models.FloatField(null=True, blank=True)
    bmr = models.FloatField(null=True, blank=True)

    def __str__(self):
        return self.name

    def calculate_bmr(self):
        if None in (self.weight, self.height, self.age, self.gender):
            return
        weight = float(self.weight)  # type: ignore
        height = float(self.height)  # type: ignore
        age = float(self.age)  # type: ignore

        if self.gender == "male":
            bmr = 66.47 + (13.75 * weight) + (5.003 * height) - (6.755 * age)
        else:
            bmr = 655.1 + (9.563 * weight) + (1.850 * height) - (4.676 * age)
        self.bmr = bmr
        self.save(update_fields=["bmr"])


class CalorieConsumed(models.Model):
    user = models.ForeignKey("auth.User", on_delete=models.CASCADE, related_name="consumed")
    date = models.DateField(null=True, blank=True)
    item_name = models.CharField(max_length=200)
    calorie_consumed = models.PositiveIntegerField()
    created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
    updated_at = models.DateTimeField(auto_now=True, null=True, blank=True)

    class Meta:
        ordering = ['-date', '-created_at']

    def __str__(self):
        return f"{self.item_name} - {self.date} - {self.calorie_consumed} kcal"



forms.py
from django.db import models

class Profile(models.Model):
    CHOOSE_GENDER = [
        ("", "Select"),
        ("male", "Male"),
        ("female", "Female"),
    ]
    user = models.OneToOneField(
        "auth.User", on_delete=models.CASCADE, related_name="user_profile"
    )
    name = models.CharField(max_length=100)
    gender = models.CharField(
        choices=CHOOSE_GENDER, max_length=10, null=True, blank=True
    )
    age = models.PositiveIntegerField(null=True, blank=True)
    weight = models.FloatField(null=True, blank=True)
    height = models.FloatField(null=True, blank=True)
    bmr = models.FloatField(null=True, blank=True)

    def __str__(self):
        return self.name

    def calculate_bmr(self):
        if None in (self.weight, self.height, self.age, self.gender):
            return
        weight = float(self.weight)  # type: ignore
        height = float(self.height)  # type: ignore
        age = float(self.age)  # type: ignore

        if self.gender == "male":
            bmr = 66.47 + (13.75 * weight) + (5.003 * height) - (6.755 * age)
        else:
            bmr = 655.1 + (9.563 * weight) + (1.850 * height) - (4.676 * age)
        self.bmr = bmr
        self.save(update_fields=["bmr"])


class CalorieConsumed(models.Model):
    user = models.ForeignKey("auth.User", on_delete=models.CASCADE, related_name="consumed")
    date = models.DateField(null=True, blank=True)
    item_name = models.CharField(max_length=200)
    calorie_consumed = models.PositiveIntegerField()
    created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
    updated_at = models.DateTimeField(auto_now=True, null=True, blank=True)

    class Meta:
        ordering = ['-date', '-created_at']

    def __str__(self):
        return f"{self.item_name} - {self.date} - {self.calorie_consumed} kcal"


admin.py
from django.contrib import admin
from .models import Profile, CalorieConsumed

@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):
    list_display = ('user', 'name', 'age', 'weight', 'height')
   
@admin.register(CalorieConsumed)  
class CalorieConsumedAdmin(admin.ModelAdmin):
    list_display = ('date', 'item_name', 'calorie_consumed')


views.py
from django.shortcuts import render, redirect  
from .forms import RegistrationForm
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import login
from django.contrib import messages
from .forms import ProfileForm,CalorieEntryForm
from django.contrib.auth.decorators import login_required
from .models import Profile, CalorieConsumed
from django.utils import timezone
from django.db.models import Sum
from django.db.utils import OperationalError

def user_registration(request):
    if request.method == 'POST':
        form = RegistrationForm(request.POST)
        if form.is_valid():
            form.save()
            messages.success(request, "Registration Successfull! Login Now")
            return redirect("login")
        else:
            messages.error(request, "Registration Failed! Invalid Information")
            return redirect("register")
    else:
        form = RegistrationForm()
    context = {
        'form': form,
    }
    return render(request, 'register.html', context)

def login_view(request):
    if request.method == 'POST':
        form = AuthenticationForm(request, data=request.POST)
        if form.is_valid():
            user = form.get_user()
            login(request, user)
            messages.success(request, "Login Successfull! Update your profile first")
            return redirect('dashboard')
        else:
            messages.error(request, "Login Failed! Invalid Credentials")
            return redirect("login")
    else:
        form = AuthenticationForm(request)
    context = {
        'form': form,
        'login_flag': True
    }
    return render(request, 'login.html', context)

@login_required
def dashboard_view(request):
    # Try to order by date (newest first) and then by creation time so latest added appears first.
    # If migrations adding `created_at` haven't been applied yet, fall back to ordering by date only.
    try:
        caloriedata = CalorieConsumed.objects.filter(user=request.user).order_by('-date', '-created_at')
        # force a small DB hit to ensure the `created_at` column exists
        caloriedata.exists()
    except OperationalError:
        caloriedata = CalorieConsumed.objects.filter(user=request.user).order_by('-date')
    today = timezone.localdate()
    try:
        total_calories_today = caloriedata.filter(date=today).aggregate(total=Sum('calorie_consumed'))['total'] or 0
    except Exception:
        total_calories_today = 0

    profile_data, created = Profile.objects.get_or_create(user=request.user or None)
    bmr = profile_data.bmr if profile_data.bmr else 0
    context={
        'caloriedata': caloriedata,
        'total_cal': total_calories_today,
        'req_bmr': round(bmr, 2) # type: ignore
    }
    return render(request, 'dashboard.html', context)

@login_required
def ProfileView(request):
    profile, created = Profile.objects.get_or_create(user=request.user)
    if request.method == 'POST':
        form = ProfileForm(request.POST, instance=profile)
        if form.is_valid():
            form.save()
            profile.calculate_bmr()
            messages.success(request, "Profile info Updated successfully")
            return redirect("dashboard")
        else:
            messages.error(request, "Any of the form filed is invalid")
            return redirect("profile")
    else:
        form = ProfileForm(instance=profile)
    context = {
        'form' : form,
        'profile_form': True
    }
    return render(request, "profile.html", context)

@login_required
def CalorieEntryView(request):
    if request.method == 'POST':
        form = CalorieEntryForm(request.POST)
        if form.is_valid():
            form_data = form.save(commit=False)
            form_data.user = request.user
            form_data.save()
            messages.success(request, "Calorie info Updated successfully")
            return redirect("dashboard")
        else:
            messages.error(request, 'Form data is invalid')
            return redirect("calorie_entry")
    else:
        form = CalorieEntryForm()
    context = {
        'form' : form,
    }
    return render(request, "calorie.html", context)

urls.py
from django.urls import path
from django.contrib.auth.views import LogoutView
from.views import (
    user_registration,
    login_view,
    dashboard_view,
    ProfileView,
    CalorieEntryView
)

urlpatterns = [
# Authentication
    path('auth/register/', user_registration, name='register'),
    path('auth/login/', login_view, name='login'),
    path('auth/logout/', LogoutView.as_view(), name='logout'),
   
    # Main pages
    path('', dashboard_view, name='dashboard'),
    path('profile/', ProfileView, name='profile'),
    path('calorie/entry/', CalorieEntryView, name='calorie_entry'),
]


templates global
base.html
{% load static %}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Calory Counter</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous" />
    <link rel="stylesheet" href="{% static 'main.css' %}" />
  </head>
  <body>
    <div class="continer-fluid">
      <div class="row">
        <div class="col-md-12">
          <div class="body-wrap d-flex justify-content-start align-items-start gap-2">
            <div class="sidebar modern-sidebar d-flex flex-column align-items-center py-4">
              <div class="logo mb-4 w-100 text-center sidebar-logo-area">
                <a class="text-decoration-none sidebar-logo-text d-flex flex-column align-items-center gap-1" href="/">
                  <span class="sidebar-logo-icon-wrap d-flex align-items-center justify-content-center mb-1">
                    <i class="bi bi-fire fs-1 sidebar-logo-icon"></i>
                  </span>
                  <span class="sidebar-brand-text">Calorie <span class="sidebar-brand-highlight">Counter</span></span>
                </a>
              </div>
              <ul class="sidebar-nav nav flex-column w-100 gap-2">
                <li class="nav-item">
                  <a class="nav-link d-flex align-items-center gap-2 px-3 py-2 rounded-3 sidebar-link {% if request.path == '/' %}active{% endif %}" href="{% url 'dashboard' %}">
                    <i class="bi bi-speedometer2"></i> Dashboard
                  </a>
                </li>
                <li class="nav-item">
                  <a class="nav-link d-flex align-items-center gap-2 px-3 py-2 rounded-3 sidebar-link" href="{% url 'calorie_entry' %}">
                    <i class="bi bi-plus-circle"></i> Add Calorie
                  </a>
                </li>
                <li class="nav-item">
                  <a class="nav-link d-flex align-items-center gap-2 px-3 py-2 rounded-3 sidebar-link" href="{% url 'profile' %}">
                    <i class="bi bi-person"></i> Profile
                  </a>
                </li>
              </ul>
            </div>
            <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
            <div class="bodycontent">
              <div class="top-bar-excel position-fixed d-flex justify-content-between align-items-center px-4 py-2 shadow-sm" style="z-index: 1000;">
                <div class="d-flex align-items-center gap-3">
                  <span class="topbar-icon d-flex align-items-center justify-content-center me-2">
                    <i class="bi bi-bar-chart-steps"></i>
                  </span>
                  <span class="fw-bold fs-5">Welcome back, {{ user }}</span>
                </div>
                <div class="d-flex align-items-center gap-2 position-relative">
                  <div class="dropdown">
                    <button class="btn topbar-avatar d-inline-flex align-items-center justify-content-center dropdown-toggle" type="button" id="profileDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                      <i class="bi bi-person-circle"></i>
                    </button>
                    <ul class="dropdown-menu dropdown-menu-end topbar-profile-dropdown" aria-labelledby="profileDropdown">
                      <li><a class="dropdown-item" href="{% url 'profile' %}"><i class="bi bi-person me-2"></i>Profile</a></li>
                      <li><hr class="dropdown-divider"></li>
                      <li><a class="dropdown-item text-danger" href="{% url 'logout' %}"><i class="bi bi-box-arrow-right me-2"></i>Logout</a></li>
                    </ul>
                  </div>
                </div>
              </div>
              <span class="d-block mt-5">{% include 'partials/alert.html' %}</span>
              {% block content %}

              {% endblock %}
            </div>
          </div>
        </div>
      </div>
    </div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
    <script src="{% static 'main.js' %}"></script>
  </body>
</html>


templates app
    partials
    alert.html
{% if messages %}
  {% for message in messages %}
    <div class="alert alert-warning alert-dismissible fade show" role="alert">
      {{ message }}
      <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
    </div>
  {% endfor %}
{% endif %}


    auth-base.html
{% load static %}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>
    {% if login_flag %}
    Login | Calorie Counter
    {% else %}
    Register | Calorie Counter
    {% endif %}
  </title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous" />
  <link rel="stylesheet" href="{% static 'main.css' %}" />
</head>

<body>
  <div class="container">
    <div class="row d-flex justify-content-center align-items-center py-5" style="min-height: 100vh;">
      <div class="col-md-8">
        <div class="mb-2 text-center">
          <h2 class="text-center">Calorie Tracker</h2>
          <p class="text-center">Your personal calorie companion</p>
        </div>
        <div class="card mx-auto rounded-3 shadow-sm p-4" style="max-width: 500px; width: 100%;">
          <div class="card-body">
            {% include 'partials/alert.html' %}
            <h3 class="card-title text-center">
              {% if login_flag %}
              Login
              {% else %}
              Register
              {% endif %}
            </h3>
            <form method="post">
              {% block form_auth %}

              {% endblock %}
              <button type="submit" class="btn btn-primary d-block w-100 mt-4">
                {% if login_flag %}
                Login
                {% else %}
                Register
                {% endif %}
              </button>
            </form>
            <p class="mt-4">
              {% if login_flag %}
              Dont have an account? <a class="badge bg-primary text-decoration-none"
                href="{% url 'register' %}">Register</a>
              {% else %}
              Already have an account? <a class="badge bg-primary text-decoration-none"
                href="{% url 'login' %}">Login</a>
              {% endif %}
            </p>
          </div>
        </div>
      </div>
    </div>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"
    integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI"
    crossorigin="anonymous"></script>
</body>
</html>


calorie.html
{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block content %}
<div class="add-calorie-page d-flex justify-content-center align-items-center py-5">
  <div class="card add-calorie-card shadow-lg border-0 p-4">
    <div class="text-center mb-3">
      <span class="add-calorie-icon d-inline-flex align-items-center justify-content-center mb-2">
        <i class="bi bi-egg-fried"></i>
      </span>
      <h2 class="mb-1">Add Calorie Intake</h2>
      <p class="text-muted mb-3">Log your meal and calories for today</p>
    </div>
    <form action="" method="post">
      {% csrf_token %}
      <div class="mb-3">
        {{ form|crispy }}
      </div>
      <button type="submit" class="btn btn-primary w-100 py-2">Add Calories</button>
    </form>
  </div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
{% endblock %}


dashboard.html
{% extends 'base.html' %}

{% block content %}
<div class="container-fluid dashboard-main" style="margin-top: 50px;">
  <div class="row g-4 mb-4">
    <div class="col-md-4">
      <div class="card dashboard-card gradient-blue text-white shadow-lg border-0">
        <div class="card-body d-flex align-items-center gap-3">
          <span class="dashboard-icon bg-white bg-opacity-25 rounded-circle d-flex align-items-center justify-content-center">
            <i class="bi bi-fire fs-2"></i>
          </span>
          <div>
            <h6 class="card-title mb-1">Required Calories</h6>
            <h2 class="card-text fw-bold mb-0">{{ req_bmr }}</h2>
            <small>BMR (Basal Metabolic Rate)</small>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-4">
      <div class="card dashboard-card gradient-green text-white shadow-lg border-0">
        <div class="card-body d-flex align-items-center gap-3">
          <span class="dashboard-icon bg-white bg-opacity-25 rounded-circle d-flex align-items-center justify-content-center">
            <i class="bi bi-egg-fried fs-2"></i>
          </span>
          <div>
            <h6 class="card-title mb-1">Calories Consumed Today</h6>
            <h2 class="card-text fw-bold mb-0">
              {% if total_cal and total_cal > 0 %}
                {{ total_cal }} Kcal
              {% else %}
                No entry
              {% endif %}
            </h2>
            <small>Today's total intake</small>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-4">
      <div class="card dashboard-card gradient-orange text-white shadow-lg border-0">
        <div class="card-body d-flex align-items-center gap-3">
          <span class="dashboard-icon bg-white bg-opacity-25 rounded-circle d-flex align-items-center justify-content-center">
            <i class="bi bi-person-circle fs-2"></i>
          </span>
          <div>
            <h6 class="card-title mb-1">Profile</h6>
            <h2 class="card-text fw-bold mb-0">{{ user.username }}</h2>
            <small>View your profile</small>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col-md-12">
      <div class="recent-wrap bg-white shadow p-4 border-0 rounded-4">
        <div class="d-flex justify-content-between align-items-center mb-3">
          <div>
            <h2 class="mb-1">Recent Meals</h2>
            <p class="mb-0 text-muted">Latest food and calorie entries</p>
          </div>
          <a href="{% url 'calorie_entry' %}" class="btn btn-primary btn-lg rounded-pill px-4">Add New</a>
        </div>
        <div class="recent-meal-list">
          {% if caloriedata %}
            {% for cal in caloriedata %}
              <div class="card mb-3 border-0 shadow-sm recent-meal-card">
                <div class="card-body d-flex justify-content-between align-items-center">
                  <div>
                    <span class="fw-bold fs-5">{{ cal.item_name }}</span>
                    <br>
                    <small class="text-muted">{{ cal.date }}</small>
                  </div>
                  <span class="badge bg-gradient bg-primary fs-6 px-3 py-2">{{ cal.calorie_consumed }} Kcal</span>
                </div>
              </div>
            {% endfor %}
          {% else %}
            <div class="alert alert-info">No recent meals found.</div>
          {% endif %}
        </div>
      </div>
    </div>
  </div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
{% endblock %}

login.html
{% extends 'partials/auth-base.html' %}
{% load crispy_forms_tags %}

{% block form_auth %}
    {% csrf_token %}
    {{ form|crispy }}
{% endblock %}

profile.html
{% extends 'base.html' %}
{% load crispy_forms_tags %}

{% block content %}
<div class="profile-page d-flex justify-content-center align-items-center py-5">
  <div class="card profile-card shadow-lg border-0 p-4">
    <div class="text-center mb-3">
      <span class="profile-icon d-inline-flex align-items-center justify-content-center mb-2">
        <i class="bi bi-person-circle"></i>
      </span>
      <h2 class="mb-1">Update Profile</h2>
      <p class="text-muted mb-3">Edit your personal information</p>
    </div>
    <form action="" method="post">
      {% csrf_token %}
      <div class="mb-3">
        {{ form|crispy }}
      </div>
      <button type="submit" class="btn btn-primary w-100 py-2">Update Profile</button>
    </form>
  </div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
{% endblock %}


register.html
{% extends 'partials/auth-base.html' %}
{% load crispy_forms_tags %}

{% block form_auth %}
    {% csrf_token %}
    {{ form|crispy }}
{% endblock %}