diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..b50190b 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..803d053 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fa..b441858 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 6867ddf..a9e07f0 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..8e9da68 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,13 @@ from django.contrib import admin +from .models import Client, Case -# Register your models here. +@admin.register(Client) +class ClientAdmin(admin.ModelAdmin): + list_display = ('name', 'email', 'phone', 'created_at') + search_fields = ('name', 'email') + +@admin.register(Case) +class CaseAdmin(admin.ModelAdmin): + list_display = ('case_number', 'case_title', 'client', 'status', 'created_at') + list_filter = ('status', 'client') + search_fields = ('case_number', 'case_title') \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..c278c98 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,38 @@ +# Generated by Django 5.2.7 on 2025-12-21 18:03 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Client', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=200, verbose_name='Name')), + ('email', models.EmailField(max_length=254, unique=True, verbose_name='Email')), + ('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='Phone')), + ('address', models.TextField(blank=True, null=True, verbose_name='Address')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.CreateModel( + name='Case', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('case_title', models.CharField(max_length=200, verbose_name='Case Title')), + ('case_number', models.CharField(max_length=50, unique=True, verbose_name='Case Number')), + ('status', models.CharField(choices=[('OPEN', 'Open'), ('CLOSED', 'Closed'), ('PENDING', 'Pending')], default='OPEN', max_length=10, verbose_name='Status')), + ('description', models.TextField(verbose_name='Description')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cases', to='core.client')), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..6e72eaa Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..e3d3850 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,33 @@ from django.db import models +from django.utils.translation import gettext_lazy as _ -# Create your models here. +class Client(models.Model): + name = models.CharField(_("Name"), max_length=200) + email = models.EmailField(_("Email"), max_length=254, unique=True) + phone = models.CharField(_("Phone"), max_length=20, blank=True, null=True) + address = models.TextField(_("Address"), blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.name + +class Case(models.Model): + class CaseStatus(models.TextChoices): + OPEN = 'OPEN', _('Open') + CLOSED = 'CLOSED', _('Closed') + PENDING = 'PENDING', _('Pending') + + case_title = models.CharField(_("Case Title"), max_length=200) + case_number = models.CharField(_("Case Number"), max_length=50, unique=True) + client = models.ForeignKey(Client, on_delete=models.CASCADE, related_name='cases') + status = models.CharField( + _("Status"), + max_length=10, + choices=CaseStatus.choices, + default=CaseStatus.OPEN, + ) + description = models.TextField(_("Description")) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.case_number}: {self.case_title}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..f6fcb2b 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,61 @@ -
- -