diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..7fb1478 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..7812d1d Binary files /dev/null and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..403759f 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..7c7ea4c 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..9b008bf 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..1f25b5b 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin +from .models import Lead, Call -# Register your models here. +admin.site.register(Lead) +admin.site.register(Call) diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..76f699f --- /dev/null +++ b/core/forms.py @@ -0,0 +1,12 @@ +from django import forms +from .models import Lead, Call + +class LeadForm(forms.ModelForm): + class Meta: + model = Lead + fields = ['company', 'contact_name', 'phone', 'notes', 'status'] + +class CallForm(forms.ModelForm): + class Meta: + model = Call + fields = ['call_outcome', 'summary', 'developments', 'requirements_raised', 'actions_taken', 'next_followup_date', 'followup_required'] diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..4dd7e7e --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 5.2.7 on 2025-10-28 12:12 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Lead', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('company', models.CharField(max_length=255)), + ('contact_name', models.CharField(max_length=255)), + ('phone', models.CharField(max_length=20)), + ('notes', models.TextField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('last_contacted_at', models.DateTimeField(auto_now=True)), + ], + ), + ] diff --git a/core/migrations/0002_call.py b/core/migrations/0002_call.py new file mode 100644 index 0000000..00bc53d --- /dev/null +++ b/core/migrations/0002_call.py @@ -0,0 +1,32 @@ +# Generated by Django 5.2.7 on 2025-10-28 12:12 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Call', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('call_outcome', models.CharField(max_length=255)), + ('summary', models.TextField()), + ('developments', models.TextField()), + ('requirements_raised', models.TextField()), + ('actions_taken', models.TextField()), + ('next_followup_date', models.DateTimeField()), + ('followup_required', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('lead', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='calls', to='core.lead')), + ('sales_rep', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/core/migrations/0003_lead_status.py b/core/migrations/0003_lead_status.py new file mode 100644 index 0000000..849900c --- /dev/null +++ b/core/migrations/0003_lead_status.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.7 on 2025-10-28 12:21 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0002_call'), + ] + + operations = [ + migrations.AddField( + model_name='lead', + name='status', + field=models.CharField(choices=[('New', 'New'), ('Contacted', 'Contacted'), ('In Progress', 'In Progress'), ('Proposal Sent', 'Proposal Sent'), ('Closed Won', 'Closed Won'), ('Closed Lost', 'Closed Lost'), ('No Answer', 'No Answer')], default='New', max_length=50), + ), + ] 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..8ce26e5 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0002_call.cpython-311.pyc b/core/migrations/__pycache__/0002_call.cpython-311.pyc new file mode 100644 index 0000000..cb401d9 Binary files /dev/null and b/core/migrations/__pycache__/0002_call.cpython-311.pyc differ diff --git a/core/migrations/__pycache__/0003_lead_status.cpython-311.pyc b/core/migrations/__pycache__/0003_lead_status.cpython-311.pyc new file mode 100644 index 0000000..50d87cf Binary files /dev/null and b/core/migrations/__pycache__/0003_lead_status.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..11f95ac 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,37 @@ from django.db import models +from django.contrib.auth.models import User -# Create your models here. +class Lead(models.Model): + company = models.CharField(max_length=255) + contact_name = models.CharField(max_length=255) + phone = models.CharField(max_length=20) + notes = models.TextField(blank=True, null=True) + status = models.CharField(max_length=50, choices=[ + ('New', 'New'), + ('Contacted', 'Contacted'), + ('In Progress', 'In Progress'), + ('Proposal Sent', 'Proposal Sent'), + ('Closed Won', 'Closed Won'), + ('Closed Lost', 'Closed Lost'), + ('No Answer', 'No Answer'), + ], default='New') + created_at = models.DateTimeField(auto_now_add=True) + last_contacted_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return self.company + +class Call(models.Model): + lead = models.ForeignKey(Lead, related_name='calls', on_delete=models.CASCADE) + sales_rep = models.ForeignKey(User, on_delete=models.CASCADE) + call_outcome = models.CharField(max_length=255) + summary = models.TextField() + developments = models.TextField() + requirements_raised = models.TextField() + actions_taken = models.TextField() + next_followup_date = models.DateTimeField() + followup_required = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"Call with {self.lead.contact_name} on {self.created_at}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 788576e..ba44d35 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -2,10 +2,20 @@
-