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