From e8065d53786f3ec9d6edce549c4fe23c14eee19d Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 21 Jan 2026 23:13:55 +0000 Subject: [PATCH] Referral Engine V1 --- core/__pycache__/models.cpython-311.pyc | Bin 209 -> 2608 bytes core/__pycache__/urls.cpython-311.pyc | Bin 347 -> 869 bytes core/__pycache__/views.cpython-311.pyc | Bin 1364 -> 2241 bytes core/migrations/0001_initial.py | 27 ++ .../__pycache__/0001_initial.cpython-311.pyc | Bin 0 -> 1624 bytes core/models.py | 27 +- core/templates/base.html | 121 ++++++++- core/templates/core/dashboard.html | 118 +++++++++ core/templates/core/index.html | 234 +++++++----------- core/templates/core/login.html | 45 ++++ core/templates/core/signup.html | 42 ++++ core/urls.py | 12 +- core/views.py | 53 ++-- 13 files changed, 504 insertions(+), 175 deletions(-) create mode 100644 core/migrations/0001_initial.py create mode 100644 core/migrations/__pycache__/0001_initial.cpython-311.pyc create mode 100644 core/templates/core/dashboard.html create mode 100644 core/templates/core/login.html create mode 100644 core/templates/core/signup.html diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index e061640edbdcec3e5c1744466c916e7acdd2763b..67bf7acb5ff836a18392b86445f72d871171524c 100644 GIT binary patch literal 2608 zcma)8O>7%Q6rR~#d)I$;-I~&$kb0}Ml@-+~Z3UqqM4Qk8YSN+vDy&MY&F&$X%m_)vtA0_p+ON(d=PZ2&cg9ys)XP>vip*wIR{R;q;HlnY7~4yY&I?0PqK3KHX) zw{PCOoq6wj@6GzVR4R_3{d(nUX`M&t4>k!}q|0pn1k4?zBOM#4f{Pe4o-?=#U*tWW zH-t*081Z<)h*rd+=BWXW5MQ2aM}YHek;Z~L_`uH{Iayf!3qq& z>9JdA3D^gL02LGesT+SzH>pP^P(HEF-p*q;TB+*9uz(Xjun2``tX8#b#Zs>km`Idp zq;!qYaV)0aXGUKey>IkHVF z=4p9hVVZh$SzN*Z01Ur*0Py8xFo!*)Z5k;CTX9DdO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4kCO`IJ`SZAgSPuebCQdeV)DI z!j$y=v+%gtL(#_ngYImMaZKXQvRC%LCZXX}AeluwJYTa=y5 z5B=7V`*7X;k1?`piMNp|<($B#3esz`&Vi4gt4kFKe=%8!C+YgmXo+$^t;~fa&oG?Id Si$@7JbN!_^aQ==_pVfa3fVhPK literal 0 HcmV?d00001 diff --git a/core/models.py b/core/models.py index 71a8362..3b991e3 100644 --- a/core/models.py +++ b/core/models.py @@ -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() \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..4928a2e 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,9 +1,10 @@ - +{% load static %} - {% block title %}Knowledge Base{% endblock %} + + {% block title %}Referral Rewards{% endblock %} {% if project_description %} @@ -13,13 +14,121 @@ {% endif %} - {% load static %} + + + + + + + + + + {% block head %}{% endblock %} - {% block content %}{% endblock %} - + - +
+ {% if messages %} +
+ {% for message in messages %} + + {% endfor %} +
+ {% endif %} + + {% block content %}{% endblock %} +
+ +
+
+

© 2026 Referral Rewards. All rights reserved.

+
+
+ + + + {% block scripts %}{% endblock %} + + \ No newline at end of file diff --git a/core/templates/core/dashboard.html b/core/templates/core/dashboard.html new file mode 100644 index 0000000..874c0c3 --- /dev/null +++ b/core/templates/core/dashboard.html @@ -0,0 +1,118 @@ +{% extends 'base.html' %} + +{% block title %}Dashboard - Referral Rewards{% endblock %} + +{% block content %} +
+
+ +
+
+
+
+ {{ user.username|first|upper }} +
+
+

Hello, {{ user.username }}!

+

Track your progress and share your rewards.

+
+
+
+
+ + +
+
+

Total Points

+

{{ profile.points }}

+

Points to next reward: 100

+
+
+
+
+
+ + +
+
+

Your Referral Link

+

Share this code with your friends and earn points when they sign up!

+ +
+ + +
+ +
+ + +
+
+
+ + +
+
+
+

Marketing Collateral

+

Assets to help you promote your referral code.

+
+ +
+
+
+
+
+ Social Media Banner 1 +
+
+ +
+
+
+
+
+
+ Email Signature +
+
+ +
+
+
+
+
+
+ Instagram Story Template +
+
+ +
+
+
+
+
+
+
+ + +{% endblock %} diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..1aa9d0f 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,95 @@ -{% extends "base.html" %} - -{% block title %}{{ project_name }}{% endblock %} - -{% block head %} - - - - -{% endblock %} +{% extends 'base.html' %} +{% load static %} {% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… +
+
+
+
+

Turn Friendships into Rewards

+

Share the love and get rewarded for every friend you refer. It's simple, fast, and completely free to join.

+ +
+
+
+
+
+ + + + +
+

Referral Success!

+
+

"I just invited 5 friends and earned 500 points toward my next purchase. It was so easy!"

+
+
+
+ Alex Johnson +
+ +500 pts +
+
+
+
-

AppWizzy AI is collecting your requirements and applying the first changes.

-

This page will refresh automatically as the plan is implemented.

-

- Runtime: Django {{ django_version }} · Python {{ python_version }} - — UTC {{ current_time|date:"Y-m-d H:i:s" }} -

-
-
-
- Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC) -
-{% endblock %} \ No newline at end of file + + +
+ + + +
+ + +
+
+
+

How it Works

+

Get started in minutes and begin your journey toward amazing rewards.

+
+
+
+
+
+ 1 +
+

Create Account

+

Sign up in seconds. You'll instantly get a unique referral code to share with your network.

+
+
+
+
+
+ 2 +
+

Share Code

+

Send your code to friends or share it on social media. Use our marketing collateral to stand out.

+
+
+
+
+
+ 3 +
+

Get Rewards

+

Watch your points grow every time someone signs up using your code. Redeem points for exclusive perks.

+
+
+
+
+
+ +
+
+
+

Ready to start earning?

+

Join thousands of customers who are already getting rewarded for their loyalty.

+ Sign Up for Free +
+
+
+{% endblock %} diff --git a/core/templates/core/login.html b/core/templates/core/login.html new file mode 100644 index 0000000..a9e978a --- /dev/null +++ b/core/templates/core/login.html @@ -0,0 +1,45 @@ +{% extends 'base.html' %} + +{% block title %}Login - Referral Rewards{% endblock %} + +{% block content %} +
+
+
+
+
+

Welcome Back

+

Login to manage your referrals.

+
+ +
+ {% csrf_token %} + {% if form.non_field_errors %} +
+ {% for error in form.non_field_errors %} + {{ error }} + {% endfor %} +
+ {% endif %} + +
+ + +
+ +
+ + +
+ + +
+ +
+

Don't have an account? Sign Up

+
+
+
+
+
+{% endblock %} diff --git a/core/templates/core/signup.html b/core/templates/core/signup.html new file mode 100644 index 0000000..4c4fd28 --- /dev/null +++ b/core/templates/core/signup.html @@ -0,0 +1,42 @@ +{% extends 'base.html' %} + +{% block title %}Join Referral Rewards{% endblock %} + +{% block content %} +
+
+
+
+
+

Create Your Account

+

Start earning rewards today.

+
+ +
+ {% csrf_token %} + {% for field in form %} +
+ + {{ field.errors }} + + {% if field.help_text %} +
{{ field.help_text|safe }}
+ {% endif %} +
+ {% endfor %} + + +
+ +
+

Already have an account? Log In

+
+
+
+
+
+{% endblock %} diff --git a/core/urls.py b/core/urls.py index 6299e3d..8493052 100644 --- a/core/urls.py +++ b/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"), +] \ No newline at end of file diff --git a/core/views.py b/core/views.py index c9aed12..4afd890 100644 --- a/core/views.py +++ b/core/views.py @@ -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') \ No newline at end of file