Compare commits

...

1 Commits

Author SHA1 Message Date
Flatlogic Bot
98b0837178 Auto commit: 2026-03-02T15:46:47.640Z 2026-03-02 15:46:47 +00:00
16 changed files with 515 additions and 186 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 KiB

View File

@ -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'

View File

@ -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')

View File

@ -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')),
],
),
]

View File

@ -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}"

View File

@ -1,25 +1,87 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title>
{% if project_description %}
<meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}">
<meta property="twitter:description" content="{{ project_description }}">
{% endif %}
{% if project_image_url %}
<meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
{% block head %}{% endblock %}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Travel Consult - Flight Price Drops & Points Deals{% endblock %}</title>
<meta name="description" content="{% block meta_description %}Your destination for the best travel deals, flight price drops, and airline points opportunities.{% endblock %}">
<!-- Bootstrap CSS CDN -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ current_time|date:'U' }}">
{% block extra_head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
</body>
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<div class="container">
<a class="navbar-brand" href="{% url 'home' %}">TravelConsult</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto align-items-center">
<li class="nav-item">
<a class="nav-link" href="{% url 'home' %}">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/#deals">Latest Deals</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-primary text-white" href="/admin/">Admin Portal</a>
</li>
</ul>
</div>
</div>
</nav>
</html>
<main style="margin-top: 75px;">
{% if messages %}
<div class="container mt-3">
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
{% endfor %}
</div>
{% endif %}
{% block content %}{% endblock %}
</main>
<footer class="bg-white py-5 mt-5">
<div class="container">
<div class="row">
<div class="col-md-4 mb-4">
<h5 class="mb-4">TravelConsult</h5>
<p class="text-muted">Helping you find the best value in travel through data-driven price tracking and points strategies.</p>
</div>
<div class="col-md-4 mb-4">
<h5 class="mb-4">Quick Links</h5>
<ul class="list-unstyled">
<li><a href="{% url 'home' %}" class="text-decoration-none text-muted">Home</a></li>
<li><a href="/#deals" class="text-decoration-none text-muted">Latest Deals</a></li>
<li><a href="/admin/" class="text-decoration-none text-muted">Admin Login</a></li>
</ul>
</div>
<div class="col-md-4 mb-4">
<h5 class="mb-4">Contact</h5>
<p class="text-muted">Questions? Reach out via our deal forms or contact our consultants directly.</p>
</div>
</div>
<hr>
<div class="text-center text-muted">
&copy; {{ current_time|date:"Y" }} TravelConsult. All rights reserved.
</div>
</div>
</footer>
<!-- Bootstrap JS CDN -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
{% block extra_js %}{% endblock %}
</body>
</html>

View File

@ -1,145 +1,92 @@
{% extends "base.html" %}
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ project_name }}{% endblock %}
{% block head %}
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
inset: 0;
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% {
background-position: 0% 0%;
}
100% {
background-position: 100% 100%;
}
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2.5rem 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
}
h1 {
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
font-weight: 700;
margin: 0 0 1.2rem;
letter-spacing: -0.02em;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
opacity: 0.92;
}
.loader {
margin: 1.5rem auto;
width: 56px;
height: 56px;
border: 4px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.runtime code {
background: rgba(0, 0, 0, 0.25);
padding: 0.15rem 0.45rem;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
footer {
position: absolute;
bottom: 1rem;
width: 100%;
text-align: center;
font-size: 0.85rem;
opacity: 0.75;
}
</style>
{% endblock %}
{% block title %}TravelConsult - Curated Flight & Points Deals{% endblock %}
{% block content %}
<main>
<div class="card">
<h1>Analyzing your requirements and generating your app…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
<section class="hero-section">
<div class="container text-center text-md-start">
<div class="row align-items-center">
<div class="col-md-7 mb-5 mb-md-0">
<h1 class="hero-title">Track Price Drops, Maximize Points.</h1>
<p class="hero-subtitle mb-4">We aggregate the best travel deals so you don't have to. From points-based upgrades to unbelievable flight flash sales.</p>
<div class="d-flex flex-wrap gap-3">
<a href="#deals" class="btn btn-accent btn-lg px-5 shadow-lg">Browse Deals</a>
<a href="/admin/" class="btn btn-outline-light btn-lg px-5">Join our Consultant Network</a>
</div>
</div>
<div class="col-md-5 d-none d-md-block text-center position-relative">
<div class="hero-shape shadow-lg bg-white p-4 rounded-4 text-dark text-start rotate-3">
<span class="badge bg-danger mb-2">HOT DEAL</span>
<h5>Round Trip: London &rarr; Bali</h5>
<p class="mb-2 text-muted">Airlines Flash Sale</p>
<div class="d-flex align-items-end">
<span class="text-decoration-line-through me-2 text-muted">$890</span>
<h2 class="mb-0 text-primary">$450</h2>
</div>
</div>
<div class="hero-shape shadow-lg bg-light p-4 rounded-4 text-dark text-start rotate--3 mt-n4 ms-4">
<span class="badge bg-primary mb-2">POINTS DEAL</span>
<h5>New York &rarr; Paris Business</h5>
<p class="mb-2 text-muted">Amex &rarr; Virgin Transfer</p>
<h2 class="mb-0 text-primary">15k Points</h2>
</div>
</div>
</div>
</div>
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
<p class="runtime">
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
</p>
</div>
</main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
</footer>
{% endblock %}
</section>
<section class="py-5" id="deals">
<div class="container">
<div class="row mb-5">
<div class="col-12 text-center">
<h2 class="mb-3">Latest Curated Opportunities</h2>
<p class="text-muted max-width-600 mx-auto">Updated in real-time by our network of travel consultants across the globe.</p>
</div>
</div>
<div class="row g-4">
{% for deal in deals %}
<div class="col-md-6 col-lg-4">
<div class="deal-card h-100">
{% if deal.image_url %}
<img src="{{ deal.image_url }}" alt="{{ deal.title }}" class="deal-img">
{% else %}
<img src="https://images.pexels.com/photos/2166553/pexels-photo-2166553.jpeg?auto=compress&cs=tinysrgb&w=800" alt="{{ deal.title }}" class="deal-img">
{% endif %}
<div class="deal-body d-flex flex-column">
<span class="deal-badge text-uppercase">{{ deal.get_deal_type_display }}</span>
<h4 class="mb-2">{{ deal.title }}</h4>
<p class="text-muted flex-grow-1 mb-4">{{ deal.description|truncatewords:20 }}</p>
<div class="d-flex align-items-center justify-content-between mt-auto">
<div class="price-container">
{% if deal.deal_type == 'flight' %}
<span class="old-price">${{ deal.original_price|floatformat:0 }}</span>
<span class="price-tag">${{ deal.current_price|floatformat:0 }}</span>
{% else %}
<span class="price-tag">{{ deal.points_required|default:0 }} Points</span>
{% endif %}
</div>
<a href="{% url 'deal_detail' deal.id %}" class="btn btn-primary btn-sm px-4">View Deal</a>
</div>
</div>
</div>
</div>
{% empty %}
<div class="col-12 text-center py-5">
<p class="text-muted">No active deals found. Check back later!</p>
</div>
{% endfor %}
</div>
</div>
</section>
<style>
.rotate-3 { transform: rotate(3deg); }
.rotate--3 { transform: rotate(-3deg); }
.mt-n4 { margin-top: -1.5rem; }
.ms-4 { margin-left: 1.5rem; }
.max-width-600 { max-width: 600px; }
</style>
{% endblock %}

View File

@ -1,7 +1,8 @@
from django.urls import path
from .views import home
from .views import home, deal_detail
urlpatterns = [
path("", home, name="home"),
]
path("deals/<int:pk>/", deal_detail, name="deal_detail"),
]

View File

@ -1,25 +1,73 @@
import os
import platform
from django import get_version as django_version
from django.shortcuts import render
from django.shortcuts import render, get_object_or_404, redirect
from .models import Deal, Lead
from django.contrib import messages
from django.utils import timezone
def home(request):
"""Render the landing screen with loader and environment details."""
host_name = request.get_host().lower()
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
now = timezone.now()
"""Render the landing page with published deals."""
published_deals = Deal.objects.filter(is_published=True).order_by('-created_at')[:6]
# Simple check for sample data
if not published_deals.exists():
_create_sample_deals()
published_deals = Deal.objects.filter(is_published=True).order_by('-created_at')[:6]
context = {
"project_name": "New Style",
"agent_brand": agent_brand,
"django_version": django_version(),
"python_version": platform.python_version(),
"current_time": now,
"host_name": host_name,
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
"deals": published_deals,
"current_time": timezone.now(),
}
return render(request, "core/index.html", context)
def deal_detail(request, pk):
"""Render a single deal and handle lead submissions."""
deal = get_object_or_404(Deal, pk=pk)
if request.method == "POST":
name = request.POST.get("name")
email = request.POST.get("email")
message = request.POST.get("message")
if name and email:
Lead.objects.create(deal=deal, name=name, email=email, message=message)
messages.success(request, "Your request has been sent! We will contact you soon.")
return redirect('deal_detail', pk=pk)
else:
messages.error(request, "Please fill in all required fields.")
return render(request, "core/deal_detail.html", {"deal": deal})
def _create_sample_deals():
"""Seed the database with sample deals if empty."""
deals = [
{
"title": "Unreal Points Deal: London to NYC",
"deal_type": "points",
"destination": "New York, USA",
"points_required": 15000,
"description": "Virgin Atlantic points deal. Unbeatable value for Business Class upgrade.",
"image_url": "https://images.pexels.com/photos/466685/pexels-photo-466685.jpeg?auto=compress&cs=tinysrgb&w=800",
"is_published": True
},
{
"title": "Flight Drop: Bali Flash Sale",
"deal_type": "flight",
"destination": "Bali, Indonesia",
"current_price": 450.00,
"original_price": 890.00,
"description": "Round trip from LAX. Limited seats available for March/April travel.",
"image_url": "https://images.pexels.com/photos/2166553/pexels-photo-2166553.jpeg?auto=compress&cs=tinysrgb&w=800",
"is_published": True
},
{
"title": "Business Class: Paris for Less",
"deal_type": "flight",
"destination": "Paris, France",
"current_price": 1200.00,
"original_price": 2500.00,
"description": "Lufthansa luxury at half the price. Multi-city options available.",
"image_url": "https://images.pexels.com/photos/338515/pexels-photo-338515.jpeg?auto=compress&cs=tinysrgb&w=800",
"is_published": True
},
]
for d in deals:
Deal.objects.get_or_create(title=d['title'], defaults=d)

View File

@ -1,4 +1,174 @@
/* Custom styles for the application */
body {
font-family: system-ui, -apple-system, sans-serif;
/* Custom Tokens */
:root {
--primary-color: #1A237E; /* Deep Indigo */
--secondary-color: #03A9F4; /* Sky Blue */
--accent-color: #FF5722; /* Vibrant Orange */
--bg-color: #F5F5F5;
--text-color: #333;
--card-bg: rgba(255, 255, 255, 0.85);
}
/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&family=Roboto:wght@300;400;500&display=swap');
body {
font-family: 'Roboto', sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6, .nav-link {
font-family: 'Poppins', sans-serif;
font-weight: 600;
}
/* Hero Section */
.hero-section {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
padding: 100px 0;
color: white;
position: relative;
overflow: hidden;
}
.hero-section::after {
content: '';
position: absolute;
top: -10%;
right: -5%;
width: 300px;
height: 300px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
filter: blur(50px);
}
.hero-section::before {
content: '';
position: absolute;
bottom: -10%;
left: -5%;
width: 400px;
height: 400px;
background: rgba(255, 255, 255, 0.05);
border-radius: 50%;
filter: blur(80px);
}
.hero-title {
font-size: 3.5rem;
font-weight: 700;
margin-bottom: 20px;
text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.hero-subtitle {
font-size: 1.25rem;
opacity: 0.9;
max-width: 600px;
}
/* Glassmorphism Cards */
.deal-card {
background: var(--card-bg);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 20px;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
height: 100%;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
.deal-card:hover {
transform: translateY(-10px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}
.deal-img {
height: 200px;
object-fit: cover;
width: 100%;
}
.deal-body {
padding: 25px;
}
.deal-badge {
background: var(--accent-color);
color: white;
padding: 5px 12px;
border-radius: 50px;
font-size: 0.8rem;
font-weight: 600;
display: inline-block;
margin-bottom: 10px;
}
.price-tag {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary-color);
}
.old-price {
text-decoration: line-through;
color: #888;
font-size: 0.9rem;
margin-right: 8px;
}
/* Buttons */
.btn-primary {
background-color: var(--primary-color);
border: none;
padding: 12px 30px;
border-radius: 50px;
font-weight: 600;
transition: all 0.3s;
}
.btn-primary:hover {
background-color: #0d124d;
transform: scale(1.05);
}
.btn-accent {
background-color: var(--accent-color);
color: white;
border: none;
padding: 12px 30px;
border-radius: 50px;
font-weight: 600;
transition: all 0.3s;
}
.btn-accent:hover {
background-color: #e64a19;
color: white;
transform: scale(1.05);
}
/* Navbar */
.navbar {
background: white !important;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
padding: 15px 0;
}
.navbar-brand {
font-weight: 700;
color: var(--primary-color) !important;
font-size: 1.5rem;
}
.nav-link {
color: #555 !important;
margin: 0 10px;
}
.nav-link:hover {
color: var(--primary-color) !important;
}