Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26d1bd517d |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,19 +1,3 @@
|
|||||||
"""
|
|
||||||
URL configuration for config project.
|
|
||||||
|
|
||||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
|
||||||
https://docs.djangoproject.com/en/5.2/topics/http/urls/
|
|
||||||
Examples:
|
|
||||||
Function views
|
|
||||||
1. Add an import: from my_app import views
|
|
||||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
|
||||||
Class-based views
|
|
||||||
1. Add an import: from other_app.views import Home
|
|
||||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
|
||||||
Including another URLconf
|
|
||||||
1. Import the include() function: from django.urls import include, path
|
|
||||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
|
||||||
"""
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@ -21,6 +5,7 @@ from django.conf.urls.static import static
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
|
path("accounts/", include("django.contrib.auth.urls")),
|
||||||
path("", include("core.urls")),
|
path("", include("core.urls")),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
55
core/migrations/0001_initial.py
Normal file
55
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2026-02-23 14:00
|
||||||
|
|
||||||
|
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='Instructor',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('name', models.CharField(max_length=255)),
|
||||||
|
('title', models.CharField(help_text='e.g. Professor of Computer Science', max_length=255)),
|
||||||
|
('bio', models.TextField()),
|
||||||
|
('expertise', models.CharField(max_length=255)),
|
||||||
|
('photo_url', models.URLField(blank=True, null=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Course',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=255)),
|
||||||
|
('slug', models.SlugField(unique=True)),
|
||||||
|
('description', models.TextField()),
|
||||||
|
('price', models.DecimalField(decimal_places=2, max_digits=10)),
|
||||||
|
('duration', models.CharField(help_text='e.g. 10 weeks', max_length=100)),
|
||||||
|
('level', models.CharField(choices=[('Beginner', 'Beginner'), ('Intermediate', 'Intermediate'), ('Advanced', 'Advanced')], max_length=50)),
|
||||||
|
('image_url', models.URLField(blank=True, null=True)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('instructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='courses', to='core.instructor')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='WishlistItem',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('added_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.course')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='wishlist', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'unique_together': {('user', 'course')},
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
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.
Binary file not shown.
@ -1,3 +1,42 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
# Create your models here.
|
class Instructor(models.Model):
|
||||||
|
name = models.CharField(max_length=255)
|
||||||
|
title = models.CharField(max_length=255, help_text="e.g. Professor of Computer Science")
|
||||||
|
bio = models.TextField()
|
||||||
|
expertise = models.CharField(max_length=255)
|
||||||
|
photo_url = models.URLField(blank=True, null=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
|
class Course(models.Model):
|
||||||
|
LEVEL_CHOICES = [
|
||||||
|
('Beginner', 'Beginner'),
|
||||||
|
('Intermediate', 'Intermediate'),
|
||||||
|
('Advanced', 'Advanced'),
|
||||||
|
]
|
||||||
|
title = models.CharField(max_length=255)
|
||||||
|
slug = models.SlugField(unique=True)
|
||||||
|
description = models.TextField()
|
||||||
|
instructor = models.ForeignKey(Instructor, on_delete=models.CASCADE, related_name='courses')
|
||||||
|
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||||
|
duration = models.CharField(max_length=100, help_text="e.g. 10 weeks")
|
||||||
|
level = models.CharField(max_length=50, choices=LEVEL_CHOICES)
|
||||||
|
image_url = models.URLField(blank=True, null=True)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
|
class WishlistItem(models.Model):
|
||||||
|
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='wishlist')
|
||||||
|
course = models.ForeignKey(Course, on_delete=models.CASCADE)
|
||||||
|
added_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ('user', 'course')
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.user.username} - {self.course.title}"
|
||||||
|
|||||||
@ -1,25 +1,117 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
{% if project_description %}
|
<title>{% block title %}Academic Excellence{% endblock %}</title>
|
||||||
<meta name="description" content="{{ project_description }}">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<meta property="og:description" content="{{ project_description }}">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap" rel="stylesheet">
|
||||||
<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 %}
|
{% load static %}
|
||||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}">
|
||||||
{% block head %}{% endblock %}
|
<style>
|
||||||
|
:root {
|
||||||
|
--primary-navy: #1A2B3C;
|
||||||
|
--academic-gold: #D4AF37;
|
||||||
|
--light-gray: #F4F7F6;
|
||||||
|
--slate-blue: #4A6FA5;
|
||||||
|
--text-dark: #2D3436;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
color: var(--text-dark);
|
||||||
|
background-color: var(--light-gray);
|
||||||
|
}
|
||||||
|
h1, h2, h3, .brand-font {
|
||||||
|
font-family: 'Playfair Display', serif;
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
background-color: var(--primary-navy);
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
.navbar-brand {
|
||||||
|
font-family: 'Playfair Display', serif;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--academic-gold) !important;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
.nav-link {
|
||||||
|
color: white !important;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-left: 1.5rem;
|
||||||
|
}
|
||||||
|
.nav-link:hover {
|
||||||
|
color: var(--academic-gold) !important;
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--slate-blue);
|
||||||
|
border: none;
|
||||||
|
padding: 0.8rem 1.5rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: var(--primary-navy);
|
||||||
|
}
|
||||||
|
.btn-gold {
|
||||||
|
background-color: var(--academic-gold);
|
||||||
|
color: var(--primary-navy);
|
||||||
|
border: none;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.btn-gold:hover {
|
||||||
|
background-color: #b8962d;
|
||||||
|
color: var(--primary-navy);
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
background-color: var(--primary-navy);
|
||||||
|
color: white;
|
||||||
|
padding: 4rem 0 2rem;
|
||||||
|
margin-top: 5rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% block extra_css %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
<nav class="navbar navbar-expand-lg">
|
||||||
</body>
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="{% url 'home' %}">AcademicExcellence</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' %}">Courses</a></li>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li class="nav-item"><a class="nav-link" href="{% url 'wishlist' %}">Wishlist</a></li>
|
||||||
|
<li class="nav-item ms-lg-3">
|
||||||
|
<form action="{% url 'logout' %}" method="post" style="display: inline;">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-outline-light btn-sm">Logout</button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="nav-item"><a class="nav-link" href="{% url 'login' %}">Login</a></li>
|
||||||
|
<li class="nav-item ms-lg-3"><a class="btn btn-gold btn-sm" href="{% url 'signup' %}">Get Started</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer">
|
||||||
|
<div class="container text-center">
|
||||||
|
<h3 class="mb-4">Academic Excellence</h3>
|
||||||
|
<p class="text-white-50">Empowering learners through world-class education and expert-led courses.</p>
|
||||||
|
<hr class="my-4 border-secondary">
|
||||||
|
<p class="mb-0">© 2026 Academic Excellence. All rights reserved.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
{% block extra_js %}{% endblock %}
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
45
core/templates/core/checkout_placeholder.html
Normal file
45
core/templates/core/checkout_placeholder.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Checkout - {{ course.title }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="card border-0 shadow-lg rounded-4 p-5 text-center">
|
||||||
|
<div class="mb-4">
|
||||||
|
<span class="badge bg-success bg-opacity-10 text-success p-3 rounded-circle">
|
||||||
|
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<h1 class="fw-bold mb-3">Complete Your Enrollment</h1>
|
||||||
|
<p class="text-muted mb-5">You're one step away from joining <strong>{{ course.title }}</strong>.</p>
|
||||||
|
|
||||||
|
<div class="bg-light p-4 rounded-4 mb-5 text-start">
|
||||||
|
<div class="d-flex justify-content-between mb-2">
|
||||||
|
<span>Course Fee</span>
|
||||||
|
<span class="fw-bold">${{ course.price }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex justify-content-between mb-2 text-success">
|
||||||
|
<span>Discount</span>
|
||||||
|
<span class="fw-bold">-$0.00</span>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="d-flex justify-content-between h4 mb-0">
|
||||||
|
<span class="fw-bold">Total</span>
|
||||||
|
<span class="fw-bold text-primary">${{ course.price }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-grid gap-3">
|
||||||
|
<button class="btn btn-primary py-3 fw-bold" disabled>Pay with Stripe (Coming Soon)</button>
|
||||||
|
<button class="btn btn-gold py-3 fw-bold" onclick="alert('Enrollment successful (Demo Mode)!')">Enroll for Free (Demo)</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="mt-4 small text-muted">This is a placeholder for the final checkout flow.</p>
|
||||||
|
<a href="{% url 'course_detail' course.slug %}" class="btn btn-link text-decoration-none mt-2">Back to Course</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
111
core/templates/core/course_detail.html
Normal file
111
core/templates/core/course_detail.html
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}{{ course.title }} - Academic Excellence{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="bg-white border-bottom py-5 mb-5">
|
||||||
|
<div class="container">
|
||||||
|
<nav aria-label="breadcrumb" class="mb-4">
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li class="breadcrumb-item"><a href="{% url 'home' %}">Courses</a></li>
|
||||||
|
<li class="breadcrumb-item active">{{ course.title }}</li>
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<span class="badge bg-primary bg-opacity-10 text-primary mb-3">{{ course.level }}</span>
|
||||||
|
<h1 class="display-4 fw-bold mb-4">{{ course.title }}</h1>
|
||||||
|
<p class="lead text-muted mb-4">{{ course.description }}</p>
|
||||||
|
<div class="d-flex align-items-center gap-4">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
{% if course.instructor.photo_url %}
|
||||||
|
<img src="{{ course.instructor.photo_url }}" class="rounded-circle me-2" width="40" height="40">
|
||||||
|
{% endif %}
|
||||||
|
<div>
|
||||||
|
<small class="text-muted d-block">Instructor</small>
|
||||||
|
<a href="{% url 'instructor_detail' course.instructor.pk %}" class="fw-bold text-decoration-none text-dark">{{ course.instructor.name }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<small class="text-muted d-block">Duration</small>
|
||||||
|
<span class="fw-bold">{{ course.duration }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<small class="text-muted d-block">Price</small>
|
||||||
|
<span class="fw-bold">${{ course.price }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4 mt-5 mt-lg-0">
|
||||||
|
<div class="card border-0 shadow-lg rounded-4 overflow-hidden">
|
||||||
|
{% if course.image_url %}
|
||||||
|
<img src="{{ course.image_url }}" class="card-img-top" alt="{{ course.title }}">
|
||||||
|
{% endif %}
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<h3 class="fw-bold mb-4">${{ course.price }}</h3>
|
||||||
|
<div class="d-grid gap-3">
|
||||||
|
<a href="{% url 'checkout_placeholder' course.id %}" class="btn btn-primary py-3">Enroll Now</a>
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<a href="{% url 'toggle_wishlist' course.id %}" class="btn {% if is_in_wishlist %}btn-danger{% else %}btn-outline-primary{% endif %} py-3">
|
||||||
|
{% if is_in_wishlist %}Remove from Wishlist{% else %}Add to Wishlist{% endif %}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="{% url 'login' %}?next={{ request.path }}" class="btn btn-outline-primary py-3">Login to Save</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<p class="text-center mt-3 mb-0 small text-muted">30-Day Money-Back Guarantee</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<h3 class="mb-4">Course Content</h3>
|
||||||
|
<div class="accordion" id="courseAccordion">
|
||||||
|
<div class="accordion-item border-0 mb-3 shadow-sm rounded-3 overflow-hidden">
|
||||||
|
<h2 class="accordion-header">
|
||||||
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#module1">
|
||||||
|
Module 1: Introduction & Fundamentals
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="module1" class="accordion-collapse collapse show">
|
||||||
|
<div class="accordion-body">
|
||||||
|
Detailed overview of core concepts and initial setup.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="accordion-item border-0 mb-3 shadow-sm rounded-3 overflow-hidden">
|
||||||
|
<h2 class="accordion-header">
|
||||||
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#module2">
|
||||||
|
Module 2: Advanced Techniques
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="module2" class="accordion-collapse collapse">
|
||||||
|
<div class="accordion-body">
|
||||||
|
Deep dive into complex topics and real-world applications.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5 p-4 bg-white shadow-sm rounded-4">
|
||||||
|
<h3 class="mb-4">About the Instructor</h3>
|
||||||
|
<div class="d-flex">
|
||||||
|
{% if course.instructor.photo_url %}
|
||||||
|
<img src="{{ course.instructor.photo_url }}" class="rounded-4 me-4" width="120" height="120" style="object-fit: cover;">
|
||||||
|
{% endif %}
|
||||||
|
<div>
|
||||||
|
<h4 class="mb-1">{{ course.instructor.name }}</h4>
|
||||||
|
<p class="text-primary fw-medium mb-3">{{ course.instructor.title }}</p>
|
||||||
|
<p class="text-muted">{{ course.instructor.bio }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
@ -1,145 +1,86 @@
|
|||||||
{% 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 content %}
|
{% block content %}
|
||||||
<main>
|
<section class="hero-section py-5 mb-5" style="background: linear-gradient(135deg, var(--primary-navy) 0%, var(--slate-blue) 100%); color: white;">
|
||||||
<div class="card">
|
<div class="container py-5">
|
||||||
<h1>Analyzing your requirements and generating your app…</h1>
|
<div class="row align-items-center">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="col-lg-6">
|
||||||
<span class="sr-only">Loading…</span>
|
<h1 class="display-3 fw-bold mb-4">Elevate Your Future with Expert Guidance</h1>
|
||||||
|
<p class="lead mb-5 opacity-75">Discover a curated catalog of world-class courses taught by leading academics and industry professionals.</p>
|
||||||
|
<div class="d-flex gap-3">
|
||||||
|
<a href="#catalog" class="btn btn-gold px-4 py-3">Browse Catalog</a>
|
||||||
|
<a href="{% url 'signup' %}" class="btn btn-outline-light px-4 py-3">Join for Free</a>
|
||||||
</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>
|
</div>
|
||||||
</main>
|
<div class="col-lg-5 offset-lg-1 d-none d-lg-block">
|
||||||
<footer>
|
<div class="p-4 bg-white bg-opacity-10 rounded-4 shadow-lg" style="backdrop-filter: blur(10px);">
|
||||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
<div class="d-flex align-items-center mb-3">
|
||||||
</footer>
|
<div class="bg-gold p-2 rounded-circle me-3" style="width: 40px; height: 40px; background-color: var(--academic-gold);"></div>
|
||||||
|
<div class="flex-grow-1 bg-white bg-opacity-20 rounded" style="height: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white bg-opacity-20 rounded mb-2" style="height: 150px;"></div>
|
||||||
|
<div class="bg-white bg-opacity-20 rounded" style="height: 10px; width: 60%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="catalog" class="container">
|
||||||
|
<div class="row mb-5 align-items-end">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<h2 class="display-5 mb-0">Our Courses</h2>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<form method="get" class="d-flex gap-2">
|
||||||
|
<input type="text" name="q" class="form-control" placeholder="Search courses..." value="{{ query }}">
|
||||||
|
<select name="level" class="form-select" style="width: 150px;">
|
||||||
|
<option value="">All Levels</option>
|
||||||
|
{% for l in levels %}
|
||||||
|
<option value="{{ l }}" {% if level == l %}selected{% endif %}>{{ l }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn btn-primary">Filter</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
{% for course in courses %}
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
{% if course.image_url %}
|
||||||
|
<img src="{{ course.image_url }}" class="card-img-top" alt="{{ course.title }}" style="height: 200px; object-fit: cover;">
|
||||||
|
{% else %}
|
||||||
|
<div class="bg-secondary bg-opacity-10 d-flex align-items-center justify-content-center" style="height: 200px;">
|
||||||
|
<span class="text-muted">No Image Available</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||||
|
<span class="badge bg-opacity-10 text-primary bg-primary px-3 py-2 rounded-pill">{{ course.level }}</span>
|
||||||
|
<span class="fw-bold text-navy">${{ course.price }}</span>
|
||||||
|
</div>
|
||||||
|
<h5 class="card-title fw-bold mb-3">{{ course.title }}</h5>
|
||||||
|
<p class="card-text text-muted small mb-4">{{ course.description|truncatewords:20 }}</p>
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
{% if course.instructor.photo_url %}
|
||||||
|
<img src="{{ course.instructor.photo_url }}" class="rounded-circle me-2" width="30" height="30">
|
||||||
|
{% endif %}
|
||||||
|
<small class="text-muted">By {{ course.instructor.name }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-white border-0 p-4 pt-0">
|
||||||
|
<a href="{% url 'course_detail' course.slug %}" class="btn btn-outline-primary w-100 rounded-3">View Details</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% empty %}
|
||||||
|
<div class="col-12 text-center py-5">
|
||||||
|
<p class="lead text-muted">No courses found matching your criteria.</p>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
45
core/templates/core/instructor_detail.html
Normal file
45
core/templates/core/instructor_detail.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}{{ instructor.name }} - Academic Excellence{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 p-4 text-center mb-4">
|
||||||
|
{% if instructor.photo_url %}
|
||||||
|
<img src="{{ instructor.photo_url }}" class="rounded-circle mx-auto mb-4" width="180" height="180" style="object-fit: cover; border: 5px solid var(--light-gray);">
|
||||||
|
{% endif %}
|
||||||
|
<h2 class="fw-bold mb-1">{{ instructor.name }}</h2>
|
||||||
|
<p class="text-primary fw-medium mb-3">{{ instructor.title }}</p>
|
||||||
|
<div class="d-flex justify-content-center gap-3">
|
||||||
|
<span class="badge bg-secondary bg-opacity-10 text-secondary px-3 py-2 rounded-pill">{{ instructor.expertise }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<h3 class="display-6 mb-4">Biography</h3>
|
||||||
|
<div class="lead text-muted mb-5">
|
||||||
|
{{ instructor.bio|linebreaks }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 class="mb-4">Courses by {{ instructor.name }}</h3>
|
||||||
|
<div class="row g-4">
|
||||||
|
{% for course in instructor.courses.all %}
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card h-100 border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<span class="badge bg-primary bg-opacity-10 text-primary mb-2">{{ course.level }}</span>
|
||||||
|
<h5 class="card-title fw-bold mb-3">{{ course.title }}</h5>
|
||||||
|
<a href="{% url 'course_detail' course.slug %}" class="btn btn-link text-decoration-none p-0 fw-bold">View Course →</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% empty %}
|
||||||
|
<p class="text-muted">No courses listed yet.</p>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
41
core/templates/core/wishlist.html
Normal file
41
core/templates/core/wishlist.html
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}My Wishlist - Academic Excellence{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="mb-5">
|
||||||
|
<h1 class="display-5 fw-bold">My Wishlist</h1>
|
||||||
|
<p class="lead text-muted">Courses you've saved for later.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
{% for item in items %}
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="card h-100 border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
{% if item.course.image_url %}
|
||||||
|
<img src="{{ item.course.image_url }}" class="card-img-top" alt="{{ item.course.title }}" style="height: 180px; object-fit: cover;">
|
||||||
|
{% endif %}
|
||||||
|
<div class="card-body p-4">
|
||||||
|
<h5 class="card-title fw-bold mb-3">{{ item.course.title }}</h5>
|
||||||
|
<p class="text-muted small mb-4">By {{ item.course.instructor.name }}</p>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<a href="{% url 'course_detail' item.course.slug %}" class="btn btn-primary flex-grow-1">View</a>
|
||||||
|
<a href="{% url 'toggle_wishlist' item.course.id %}" class="btn btn-outline-danger">Remove</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% empty %}
|
||||||
|
<div class="col-12 text-center py-5">
|
||||||
|
<div class="mb-4">
|
||||||
|
<svg width="64" height="64" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="text-muted opacity-50"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l8.84-8.84 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg>
|
||||||
|
</div>
|
||||||
|
<h3>Your wishlist is empty</h3>
|
||||||
|
<p class="text-muted mb-4">Start exploring our catalog to find your next course.</p>
|
||||||
|
<a href="{% url 'home' %}" class="btn btn-primary px-4 py-2">Explore Courses</a>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
32
core/templates/registration/login.html
Normal file
32
core/templates/registration/login.html
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Login - Academic Excellence{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 p-5">
|
||||||
|
<h2 class="fw-bold mb-4 text-center">Welcome Back</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-medium">Username</label>
|
||||||
|
<input type="text" name="username" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label class="form-label fw-medium">Password</label>
|
||||||
|
<input type="password" name="password" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary py-3 fw-bold">Login</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p class="text-center mt-4 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>
|
||||||
|
{% endblock %}
|
||||||
34
core/templates/registration/signup.html
Normal file
34
core/templates/registration/signup.html
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Sign Up - Academic Excellence{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 p-5">
|
||||||
|
<h2 class="fw-bold mb-4 text-center">Create Account</h2>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% for field in form %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label fw-medium">{{ field.label }}</label>
|
||||||
|
{{ field.errors }}
|
||||||
|
<input type="{{ field.field.widget.input_type }}" name="{{ field.name }}" class="form-control" required>
|
||||||
|
{% if field.help_text %}
|
||||||
|
<div class="form-text small">{{ field.help_text|safe }}</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<div class="d-grid mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary py-3 fw-bold">Sign Up</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p class="text-center mt-4 mb-0">
|
||||||
|
Already have an account? <a href="{% url 'login' %}" class="text-decoration-none fw-bold">Login</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
11
core/urls.py
11
core/urls.py
@ -1,7 +1,12 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from . import views
|
||||||
from .views import home
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path('', views.course_list, name='home'),
|
||||||
|
path('course/<slug:slug>/', views.course_detail, name='course_detail'),
|
||||||
|
path('instructor/<int:pk>/', views.instructor_detail, name='instructor_detail'),
|
||||||
|
path('wishlist/', views.wishlist, name='wishlist'),
|
||||||
|
path('wishlist/toggle/<int:course_id>/', views.toggle_wishlist, name='toggle_wishlist'),
|
||||||
|
path('checkout/<int:course_id>/', views.checkout_placeholder, name='checkout_placeholder'),
|
||||||
|
path('signup/', views.signup, name='signup'),
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,25 +1,74 @@
|
|||||||
import os
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
import platform
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.db.models import Q
|
||||||
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
|
from django.contrib.auth import login
|
||||||
|
from .models import Course, Instructor, WishlistItem
|
||||||
|
|
||||||
from django import get_version as django_version
|
def course_list(request):
|
||||||
from django.shortcuts import render
|
query = request.GET.get('q', '')
|
||||||
from django.utils import timezone
|
level = request.GET.get('level', '')
|
||||||
|
|
||||||
|
courses = Course.objects.all()
|
||||||
|
|
||||||
def home(request):
|
if query:
|
||||||
"""Render the landing screen with loader and environment details."""
|
courses = courses.filter(
|
||||||
host_name = request.get_host().lower()
|
Q(title__icontains=query) | Q(description__icontains=query)
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
)
|
||||||
now = timezone.now()
|
|
||||||
|
if level:
|
||||||
|
courses = courses.filter(level=level)
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"project_name": "New Style",
|
'courses': courses,
|
||||||
"agent_brand": agent_brand,
|
'query': query,
|
||||||
"django_version": django_version(),
|
'level': level,
|
||||||
"python_version": platform.python_version(),
|
'levels': ['Beginner', 'Intermediate', 'Advanced']
|
||||||
"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)
|
return render(request, 'core/index.html', context)
|
||||||
|
|
||||||
|
def course_detail(request, slug):
|
||||||
|
course = get_object_or_404(Course, slug=slug)
|
||||||
|
is_in_wishlist = False
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
is_in_wishlist = WishlistItem.objects.filter(user=request.user, course=course).exists()
|
||||||
|
|
||||||
|
context = {
|
||||||
|
'course': course,
|
||||||
|
'is_in_wishlist': is_in_wishlist
|
||||||
|
}
|
||||||
|
return render(request, 'core/course_detail.html', context)
|
||||||
|
|
||||||
|
def instructor_detail(request, pk):
|
||||||
|
instructor = get_object_or_404(Instructor, pk=pk)
|
||||||
|
return render(request, 'core/instructor_detail.html', {'instructor': instructor})
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def wishlist(request):
|
||||||
|
items = WishlistItem.objects.filter(user=request.user)
|
||||||
|
return render(request, 'core/wishlist.html', {'items': items})
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def toggle_wishlist(request, course_id):
|
||||||
|
course = get_object_or_404(Course, id=course_id)
|
||||||
|
wishlist_item, created = WishlistItem.objects.get_or_create(user=request.user, course=course)
|
||||||
|
|
||||||
|
if not created:
|
||||||
|
wishlist_item.delete()
|
||||||
|
|
||||||
|
return redirect(request.META.get('HTTP_REFERER', 'home'))
|
||||||
|
|
||||||
|
def checkout_placeholder(request, course_id):
|
||||||
|
course = get_object_or_404(Course, id=course_id)
|
||||||
|
return render(request, 'core/checkout_placeholder.html', {'course': course})
|
||||||
|
|
||||||
|
def signup(request):
|
||||||
|
if request.method == 'POST':
|
||||||
|
form = UserCreationForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
user = form.save()
|
||||||
|
login(request, user)
|
||||||
|
return redirect('home')
|
||||||
|
else:
|
||||||
|
form = UserCreationForm()
|
||||||
|
return render(request, 'registration/signup.html', {'form': form})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user