diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index 7d80990..3940cbd 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 ca4aa1e..5757015 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index d947244..01b28fe 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 093feca..724d9a1 100644 --- a/core/admin.py +++ b/core/admin.py @@ -3,7 +3,7 @@ from .models import Parcel @admin.register(Parcel) class ParcelAdmin(admin.ModelAdmin): - list_display = ('tracking_number', 'sender_name', 'recipient_name', 'status', 'assignee', 'received_date') - list_filter = ('status', 'assignee', 'received_date') - search_fields = ('tracking_number', 'sender_name', 'recipient_name', 'sender_email', 'recipient_email') + list_display = ('tracking_number', 'sender_name', 'recipient_name', 'status', 'assignee_first_name', 'assignee_last_name', 'received_date') + list_filter = ('status', 'assignee_first_name', 'assignee_last_name', 'received_date') + search_fields = ('tracking_number', 'sender_name', 'recipient_name', 'sender_email', 'recipient_email', 'assignee_first_name', 'assignee_last_name') ordering = ('-received_date',) \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py index 71f4da9..7bb33a6 100644 --- a/core/migrations/0001_initial.py +++ b/core/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.7 on 2026-01-11 15:58 +# Generated by Django 5.2.7 on 2026-01-11 16:23 from django.db import migrations, models @@ -21,7 +21,8 @@ class Migration(migrations.Migration): ('recipient_email', models.EmailField(max_length=254)), ('tracking_number', models.CharField(max_length=100, unique=True)), ('status', models.CharField(choices=[('pending', 'Pending'), ('processed', 'Processed'), ('rejected', 'Rejected')], default='pending', max_length=20)), - ('assignee', models.CharField(blank=True, max_length=100, null=True)), + ('assignee_first_name', models.CharField(blank=True, max_length=100, null=True)), + ('assignee_last_name', models.CharField(blank=True, max_length=100, null=True)), ('received_date', models.DateTimeField()), ], ), diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc index e01b424..00dbf4a 100644 Binary files a/core/migrations/__pycache__/0001_initial.cpython-311.pyc and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 4924dee..bd9aa0a 100644 --- a/core/models.py +++ b/core/models.py @@ -13,7 +13,8 @@ class Parcel(models.Model): recipient_email = models.EmailField() tracking_number = models.CharField(max_length=100, unique=True) status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending') - assignee = models.CharField(max_length=100, blank=True, null=True) + assignee_first_name = models.CharField(max_length=100, blank=True, null=True) + assignee_last_name = models.CharField(max_length=100, blank=True, null=True) received_date = models.DateTimeField() def __str__(self): @@ -26,4 +27,10 @@ class Parcel(models.Model): if len(parts) > 1: return (parts[0][0] + parts[-1][0]).upper() return parts[0][0].upper() - return "?" \ No newline at end of file + return "?" + + @property + def assignee_initials(self): + if self.assignee_first_name and self.assignee_last_name: + return (self.assignee_first_name[0] + self.assignee_last_name[0]).upper() + return "A" \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index c2ad44c..effc754 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -30,13 +30,8 @@ {% for parcel in parcels %} -
-
{{ parcel.sender_initials }}
-
-
{{ parcel.sender_name }}
-
{{ parcel.sender_email }}
-
-
+
{{ parcel.sender_name }}
+
{{ parcel.sender_email }}
{{ parcel.recipient_name }}
@@ -52,7 +47,14 @@ Pending {% endif %} - {{ parcel.assignee }} + +
+
{{ parcel.assignee_initials }}
+
+
{{ parcel.assignee_first_name }} {{ parcel.assignee_last_name }}
+
+
+ {{ parcel.received_date|date:"M d, Y, P" }} {% empty %} diff --git a/core/views.py b/core/views.py index 29407ed..cbcf964 100644 --- a/core/views.py +++ b/core/views.py @@ -13,7 +13,8 @@ def index(request): recipient_email='jane.smith@example.com', tracking_number='JD123456789', status='pending', - assignee='Operator 1', + assignee_first_name='John', + assignee_last_name='Smith', received_date=timezone.now() - datetime.timedelta(days=1) ) Parcel.objects.create( @@ -23,7 +24,8 @@ def index(request): recipient_email='mary.williams@example.com', tracking_number='PJ987654321', status='processed', - assignee='Admin', + assignee_first_name='Jane', + assignee_last_name='Doe', received_date=timezone.now() - datetime.timedelta(hours=5) ) Parcel.objects.create( @@ -33,7 +35,8 @@ def index(request): recipient_email='david.miller@example.com', tracking_number='SB112233445', status='rejected', - assignee='Operator 2', + assignee_first_name='Peter', + assignee_last_name='Jones', received_date=timezone.now() - datetime.timedelta(days=2) )