diff --git a/assets/pasted-20260302-154256-893bd58a.png b/assets/pasted-20260302-154256-893bd58a.png new file mode 100644 index 0000000..9b4113e Binary files /dev/null and b/assets/pasted-20260302-154256-893bd58a.png differ diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 881731c..11b9d4c 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..9d9dc44 100644 --- a/config/settings.py +++ b/config/settings.py @@ -23,11 +23,13 @@ DEBUG = os.getenv("DJANGO_DEBUG", "true").lower() == "true" ALLOWED_HOSTS = [ "127.0.0.1", "localhost", + "travel-deals.flatlogic.app", os.getenv("HOST_FQDN", ""), ] CSRF_TRUSTED_ORIGINS = [ origin for origin in [ + "travel-deals.flatlogic.app", os.getenv("HOST_FQDN", ""), os.getenv("CSRF_TRUSTED_ORIGIN", "") ] if origin @@ -179,4 +181,4 @@ if EMAIL_USE_SSL: # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' \ No newline at end of file diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index 2964e11..4ebb78a 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 18a063c..f5f90d9 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 ebb8c6e..d48e12e 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 8d204fa..421b1f4 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..321f4ad 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import Deal, Lead -# Register your models here. +@admin.register(Deal) +class DealAdmin(admin.ModelAdmin): + list_display = ('title', 'deal_type', 'destination', 'current_price', 'is_published', 'created_at') + list_filter = ('deal_type', 'is_published', 'created_at') + search_fields = ('title', 'origin', 'destination', 'description') + +@admin.register(Lead) +class LeadAdmin(admin.ModelAdmin): + list_display = ('name', 'email', 'deal', 'created_at') + list_filter = ('created_at',) + search_fields = ('name', 'email', 'message') \ 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..150cadf --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,46 @@ +# Generated by Django 5.2.7 on 2026-03-02 15:41 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Deal', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('deal_type', models.CharField(choices=[('flight', 'Flight'), ('points', 'Points/Miles')], default='flight', max_length=20)), + ('origin', models.CharField(blank=True, max_length=100)), + ('destination', models.CharField(max_length=100)), + ('current_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('original_price', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), + ('points_required', models.PositiveIntegerField(blank=True, null=True)), + ('description', models.TextField()), + ('image_url', models.URLField(blank=True, max_length=500)), + ('is_published', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('source_url', models.URLField(blank=True, max_length=500)), + ], + ), + migrations.CreateModel( + name='Lead', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('email', models.EmailField(max_length=254)), + ('phone', models.CharField(blank=True, max_length=20)), + ('message', models.TextField(blank=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('deal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='leads', to='core.deal')), + ], + ), + ] 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..477b83e 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..d2b5354 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,45 @@ from django.db import models +from django.urls import reverse -# Create your models here. +class Deal(models.Model): + DEAL_TYPES = ( + ('flight', 'Flight'), + ('points', 'Points/Miles'), + ) + + title = models.CharField(max_length=255) + deal_type = models.CharField(max_length=20, choices=DEAL_TYPES, default='flight') + origin = models.CharField(max_length=100, blank=True) + destination = models.CharField(max_length=100) + current_price = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) + original_price = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True) + points_required = models.PositiveIntegerField(null=True, blank=True) + description = models.TextField() + image_url = models.URLField(max_length=500, blank=True) + is_published = models.BooleanField(default=False) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + source_url = models.URLField(max_length=500, blank=True) + + def __str__(self): + return self.title + + def get_absolute_url(self): + return reverse('deal_detail', args=[str(self.id)]) + + @property + def discount_percentage(self): + if self.current_price and self.original_price: + return int((1 - (self.current_price / self.original_price)) * 100) + return None + +class Lead(models.Model): + deal = models.ForeignKey(Deal, on_delete=models.CASCADE, related_name='leads') + name = models.CharField(max_length=100) + email = models.EmailField() + phone = models.CharField(max_length=20, blank=True) + message = models.TextField(blank=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"Lead from {self.name} for {self.deal.title}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..23853c0 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,87 @@ +{% load static %} -
- -