Referral Engine V1
This commit is contained in:
parent
f980626014
commit
e8065d5378
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
core/migrations/0001_initial.py
Normal file
27
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,27 @@
|
||||
# Generated by Django 5.2.7 on 2026-01-21 23:10
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Profile',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('referral_code', models.CharField(blank=True, max_length=20, unique=True)),
|
||||
('points', models.IntegerField(default=0)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,28 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
import uuid
|
||||
|
||||
# Create your models here.
|
||||
class Profile(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
|
||||
referral_code = models.CharField(max_length=20, unique=True, blank=True)
|
||||
points = models.IntegerField(default=0)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.user.username}'s Profile"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.referral_code:
|
||||
self.referral_code = str(uuid.uuid4()).replace('-', '')[:8].upper()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def create_user_profile(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
Profile.objects.create(user=instance)
|
||||
|
||||
@receiver(post_save, sender=User)
|
||||
def save_user_profile(sender, instance, **kwargs):
|
||||
instance.profile.save()
|
||||
@ -1,9 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
{% load static %}
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Referral Rewards{% endblock %}</title>
|
||||
{% if project_description %}
|
||||
<meta name="description" content="{{ project_description }}">
|
||||
<meta property="og:description" content="{{ project_description }}">
|
||||
@ -13,13 +14,121 @@
|
||||
<meta property="og:image" content="{{ project_image_url }}">
|
||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||
{% endif %}
|
||||
{% load static %}
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
|
||||
|
||||
<!-- Bootstrap 5 CSS -->
|
||||
<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={{ deployment_timestamp }}">
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--primary-navy: #1A2B3C;
|
||||
--accent-teal: #20C997;
|
||||
--highlight-coral: #FF7E67;
|
||||
--soft-pearl: #F8F9FA;
|
||||
}
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
background-color: var(--soft-pearl);
|
||||
color: var(--primary-navy);
|
||||
}
|
||||
h1, h2, h3, h4, .navbar-brand {
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-weight: 700;
|
||||
}
|
||||
.navbar {
|
||||
background-color: white;
|
||||
box-shadow: 0 2px 15px rgba(0,0,0,0.05);
|
||||
padding: 1rem 0;
|
||||
}
|
||||
.btn-primary {
|
||||
background-color: var(--accent-teal);
|
||||
border-color: var(--accent-teal);
|
||||
border-radius: 8px;
|
||||
padding: 0.6rem 1.5rem;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background-color: #1ba87e;
|
||||
border-color: #1ba87e;
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.btn-outline-primary {
|
||||
color: var(--primary-navy);
|
||||
border-color: var(--primary-navy);
|
||||
border-radius: 8px;
|
||||
}
|
||||
.btn-outline-primary:hover {
|
||||
background-color: var(--primary-navy);
|
||||
color: white;
|
||||
}
|
||||
.navbar-brand span {
|
||||
color: var(--accent-teal);
|
||||
}
|
||||
</style>
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
</body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="{% url 'home' %}">Referral<span>Rewards</span></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">
|
||||
{% if user.is_authenticated %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link px-3" href="{% url 'dashboard' %}">Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link px-3" href="/admin/">Admin</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="btn btn-outline-primary ms-lg-3" href="{% url 'logout' %}">Logout</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link px-3" href="{% url 'login' %}">Login</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="btn btn-primary ms-lg-3" href="{% url 'signup' %}">Get Started</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
</html>
|
||||
<main>
|
||||
{% if messages %}
|
||||
<div class="container mt-4">
|
||||
{% for message in messages %}
|
||||
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
|
||||
{{ message }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="py-5 bg-white mt-5">
|
||||
<div class="container text-center">
|
||||
<p class="text-muted mb-0">© 2026 Referral Rewards. All rights reserved.</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap 5 JS Bundle -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
118
core/templates/core/dashboard.html
Normal file
118
core/templates/core/dashboard.html
Normal file
@ -0,0 +1,118 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Dashboard - Referral Rewards{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-5">
|
||||
<div class="row gy-4">
|
||||
<!-- Profile Header -->
|
||||
<div class="col-12">
|
||||
<div class="card border-0 shadow-sm p-4 rounded-4 bg-white">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 text-primary d-flex align-items-center justify-content-center me-4" style="width: 64px; height: 64px;">
|
||||
<span class="h3 mb-0">{{ user.username|first|upper }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<h2 class="mb-1">Hello, {{ user.username }}!</h2>
|
||||
<p class="text-muted mb-0">Track your progress and share your rewards.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats Overview -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card h-100 border-0 shadow-sm p-4 rounded-4 bg-white text-center">
|
||||
<p class="text-muted small text-uppercase fw-bold mb-2">Total Points</p>
|
||||
<h3 class="display-5 fw-bold text-primary mb-0">{{ profile.points }}</h3>
|
||||
<p class="text-muted mt-2 mb-0">Points to next reward: 100</p>
|
||||
<div class="progress mt-3" style="height: 8px;">
|
||||
<div class="progress-bar bg-primary" style="width: {{ profile.points|default:0 }}%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Referral Widget -->
|
||||
<div class="col-lg-8">
|
||||
<div class="card h-100 border-0 shadow-sm p-4 rounded-4 bg-white">
|
||||
<h4 class="mb-4">Your Referral Link</h4>
|
||||
<p class="text-muted mb-4">Share this code with your friends and earn points when they sign up!</p>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" id="referralCode" class="form-control form-control-lg bg-light border-0" value="{{ profile.referral_code }}" readonly>
|
||||
<button class="btn btn-primary px-4" type="button" onclick="copyCode()">Copy Code</button>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<button class="btn btn-outline-primary flex-fill py-2">Share on Twitter</button>
|
||||
<button class="btn btn-outline-primary flex-fill py-2">Share on WhatsApp</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Marketing Collateral Preview -->
|
||||
<div class="col-12 mt-4">
|
||||
<div class="d-flex justify-content-between align-items-end mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Marketing Collateral</h4>
|
||||
<p class="text-muted mb-0">Assets to help you promote your referral code.</p>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-outline-primary">View All</button>
|
||||
</div>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||
<span class="text-muted opacity-50">Social Media Banner 1</span>
|
||||
</div>
|
||||
<div class="card-body p-3 text-center">
|
||||
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||
<span class="text-muted opacity-50">Email Signature</span>
|
||||
</div>
|
||||
<div class="card-body p-3 text-center">
|
||||
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||
<span class="text-muted opacity-50">Instagram Story Template</span>
|
||||
</div>
|
||||
<div class="card-body p-3 text-center">
|
||||
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function copyCode() {
|
||||
var copyText = document.getElementById("referralCode");
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999);
|
||||
navigator.clipboard.writeText(copyText.value);
|
||||
|
||||
const btn = event.target;
|
||||
const originalText = btn.innerText;
|
||||
btn.innerText = "Copied!";
|
||||
btn.classList.remove('btn-primary');
|
||||
btn.classList.add('btn-success');
|
||||
|
||||
setTimeout(() => {
|
||||
btn.innerText = originalText;
|
||||
btn.classList.remove('btn-success');
|
||||
btn.classList.add('btn-primary');
|
||||
}, 2000);
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
@ -1,145 +1,95 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% 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 %}
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% 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 py-5 overflow-hidden" style="background: linear-gradient(135deg, var(--primary-navy) 0%, #1a4a5e 100%); color: white; position: relative;">
|
||||
<div class="container py-5">
|
||||
<div class="row align-items-center gy-5">
|
||||
<div class="col-lg-6">
|
||||
<h1 class="display-3 mb-4 animate__animated animate__fadeInUp">Turn Friendships into <span style="color: var(--accent-teal);">Rewards</span></h1>
|
||||
<p class="lead mb-5 opacity-75">Share the love and get rewarded for every friend you refer. It's simple, fast, and completely free to join.</p>
|
||||
<div class="d-flex gap-3">
|
||||
<a href="{% url 'signup' %}" class="btn btn-primary btn-lg px-4 py-3">Start Earning Now</a>
|
||||
<a href="#how-it-works" class="btn btn-outline-light btn-lg px-4 py-3">Learn More</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 position-relative">
|
||||
<div class="glass-card p-4 p-md-5 rounded-4 animate__animated animate__fadeInRight" style="background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 25px 50px rgba(0,0,0,0.3);">
|
||||
<div class="d-flex align-items-center mb-4">
|
||||
<div class="rounded-circle bg-success bg-opacity-25 p-3 me-3">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-person-plus text-success" viewBox="0 0 16 16">
|
||||
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H1s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C9.516 10.68 8.289 10 6 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/>
|
||||
<path fill-rule="evenodd" d="M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h4 class="mb-0">Referral Success!</h4>
|
||||
</div>
|
||||
<p class="mb-4">"I just invited 5 friends and earned 500 points toward my next purchase. It was so easy!"</p>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="rounded-circle bg-secondary me-2" style="width: 32px; height: 32px;"></div>
|
||||
<span class="small opacity-75">Alex Johnson</span>
|
||||
</div>
|
||||
<span class="badge rounded-pill bg-success px-3 py-2">+500 pts</span>
|
||||
</div>
|
||||
</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 %}
|
||||
|
||||
<!-- Decorative Shapes -->
|
||||
<div class="position-absolute bottom-0 end-0 p-5 opacity-25 d-none d-lg-block">
|
||||
<svg width="400" height="400" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill="#20C997" d="M44.7,-76.4C58.8,-69.2,71.8,-59.1,79.6,-45.8C87.4,-32.5,90,-16.3,88.5,-0.9C86.9,14.6,81.2,29.1,72.1,41.4C63.1,53.7,50.7,63.7,37.1,70.6C23.5,77.5,8.7,81.3,-5.7,81.2C-20.1,81.1,-34.1,77.1,-46.8,69.5C-59.5,61.9,-70.9,50.7,-77.7,37.5C-84.5,24.3,-86.7,9.1,-84.4,-5.2C-82.2,-19.5,-75.4,-32.8,-66,-44.4C-56.6,-56,-44.6,-65.8,-31.4,-73.4C-18.2,-81.1,-3.7,-86.5,10.5,-84.7C24.7,-82.9,30.6,-83.7,44.7,-76.4Z" transform="translate(100 100)" />
|
||||
</svg>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="how-it-works" class="py-5">
|
||||
<div class="container py-5">
|
||||
<div class="text-center mb-5">
|
||||
<h2 class="display-5 mb-3">How it Works</h2>
|
||||
<p class="text-muted mx-auto" style="max-width: 600px;">Get started in minutes and begin your journey toward amazing rewards.</p>
|
||||
</div>
|
||||
<div class="row g-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||
<span class="h2 mb-0">1</span>
|
||||
</div>
|
||||
<h3>Create Account</h3>
|
||||
<p class="text-muted">Sign up in seconds. You'll instantly get a unique referral code to share with your network.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||
<span class="h2 mb-0">2</span>
|
||||
</div>
|
||||
<h3>Share Code</h3>
|
||||
<p class="text-muted">Send your code to friends or share it on social media. Use our marketing collateral to stand out.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||
<span class="h2 mb-0">3</span>
|
||||
</div>
|
||||
<h3>Get Rewards</h3>
|
||||
<p class="text-muted">Watch your points grow every time someone signs up using your code. Redeem points for exclusive perks.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="py-5 bg-white">
|
||||
<div class="container py-5 text-center">
|
||||
<div class="card bg-primary text-white border-0 rounded-4 p-5" style="background: linear-gradient(135deg, var(--accent-teal) 0%, #17a67f 100%) !important;">
|
||||
<h2 class="display-5 mb-4">Ready to start earning?</h2>
|
||||
<p class="lead mb-5 opacity-75">Join thousands of customers who are already getting rewarded for their loyalty.</p>
|
||||
<a href="{% url 'signup' %}" class="btn btn-light btn-lg px-5 py-3 text-primary fw-bold">Sign Up for Free</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
45
core/templates/core/login.html
Normal file
45
core/templates/core/login.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Login - Referral Rewards{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-5 mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-5">
|
||||
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||
<div class="text-center mb-4">
|
||||
<h2 class="mb-3">Welcome Back</h2>
|
||||
<p class="text-muted">Login to manage your referrals.</p>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
{% for error in form.non_field_errors %}
|
||||
{{ error }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="id_username" class="form-label fw-600">Username</label>
|
||||
<input type="text" name="username" class="form-control" id="id_username" placeholder="Username" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="id_password" class="form-label fw-600">Password</label>
|
||||
<input type="password" name="password" class="form-control" id="id_password" placeholder="Password" required>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 py-3">Log In</button>
|
||||
</form>
|
||||
|
||||
<div class="text-center mt-5">
|
||||
<p class="text-muted mb-0">Don't have an account? <a href="{% url 'signup' %}" class="text-decoration-none fw-bold">Sign Up</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
42
core/templates/core/signup.html
Normal file
42
core/templates/core/signup.html
Normal file
@ -0,0 +1,42 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Join Referral Rewards{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container py-5 mt-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-5">
|
||||
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||
<div class="text-center mb-4">
|
||||
<h2 class="mb-3">Create Your Account</h2>
|
||||
<p class="text-muted">Start earning rewards today.</p>
|
||||
</div>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<div class="mb-3">
|
||||
<label for="{{ field.id_for_label }}" class="form-label fw-600">{{ field.label }}</label>
|
||||
{{ field.errors }}
|
||||
<input type="{{ field.field.widget.input_type }}"
|
||||
name="{{ field.name }}"
|
||||
class="form-control {% if field.errors %}is-invalid{% endif %}"
|
||||
id="{{ field.id_for_label }}"
|
||||
placeholder="Enter {{ field.label|lower }}">
|
||||
{% if field.help_text %}
|
||||
<div class="form-text opacity-75 small">{{ field.help_text|safe }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<button type="submit" class="btn btn-primary w-100 py-3 mt-4">Sign Up</button>
|
||||
</form>
|
||||
|
||||
<div class="text-center mt-5">
|
||||
<p class="text-muted mb-0">Already have an account? <a href="{% url 'login' %}" class="text-decoration-none fw-bold">Log In</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
12
core/urls.py
12
core/urls.py
@ -1,7 +1,11 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from django.contrib.auth import views as auth_views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
]
|
||||
path("", views.home, name="home"),
|
||||
path("signup/", views.signup, name="signup"),
|
||||
path("dashboard/", views.dashboard, name="dashboard"),
|
||||
path("login/", auth_views.LoginView.as_view(template_name='core/login.html'), name="login"),
|
||||
path("logout/", views.logout_view, name="logout"),
|
||||
]
|
||||
@ -1,25 +1,34 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
from django import get_version as django_version
|
||||
from django.shortcuts import render
|
||||
from django.utils import timezone
|
||||
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth import login, logout
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib import messages
|
||||
from .models import Profile
|
||||
|
||||
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()
|
||||
if request.user.is_authenticated:
|
||||
return redirect('dashboard')
|
||||
return render(request, 'core/index.html')
|
||||
|
||||
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", ""),
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
def signup(request):
|
||||
if request.user.is_authenticated:
|
||||
return redirect('dashboard')
|
||||
if request.method == 'POST':
|
||||
form = UserCreationForm(request.POST)
|
||||
if form.is_valid():
|
||||
user = form.save()
|
||||
login(request, user)
|
||||
messages.success(request, "Welcome to Referral Rewards! Your account has been created.")
|
||||
return redirect('dashboard')
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
return render(request, 'core/signup.html', {'form': form})
|
||||
|
||||
@login_required
|
||||
def dashboard(request):
|
||||
profile = request.user.profile
|
||||
return render(request, 'core/dashboard.html', {'profile': profile})
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return redirect('home')
|
||||
Loading…
x
Reference in New Issue
Block a user