Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

31 changed files with 167 additions and 1485 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -180,8 +180,3 @@ if EMAIL_USE_SSL:
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Authentication
LOGIN_URL = 'core:login'
LOGIN_REDIRECT_URL = 'core:student_dashboard'
LOGOUT_REDIRECT_URL = 'core:login'

View File

@ -1,53 +0,0 @@
# Generated by Django 5.2.7 on 2025-12-10 14:54
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='Assignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('description', models.TextField()),
('due_date', models.DateTimeField()),
],
),
migrations.CreateModel(
name='Exercise',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question', models.TextField()),
('answer', models.TextField()),
('assignment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='exercises', to='core.assignment')),
],
),
migrations.CreateModel(
name='Hint',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hint_text', models.TextField()),
('exercise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hints', to='core.exercise')),
],
),
migrations.CreateModel(
name='Submission',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('submitted_answer', models.TextField()),
('is_correct', models.BooleanField(default=False)),
('exercise', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.exercise')),
('student', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]

View File

@ -1,34 +1,3 @@
from django.db import models
from django.contrib.auth.models import User
class Assignment(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
due_date = models.DateTimeField()
def __str__(self):
return self.title
class Exercise(models.Model):
assignment = models.ForeignKey(Assignment, related_name='exercises', on_delete=models.CASCADE)
question = models.TextField()
answer = models.TextField()
def __str__(self):
return self.question
class Submission(models.Model):
exercise = models.ForeignKey(Exercise, on_delete=models.CASCADE)
student = models.ForeignKey(User, on_delete=models.CASCADE)
submitted_answer = models.TextField()
is_correct = models.BooleanField(default=False)
def __str__(self):
return f'{self.student.username} - {self.exercise.question}'
class Hint(models.Model):
exercise = models.ForeignKey(Exercise, related_name='hints', on_delete=models.CASCADE)
hint_text = models.TextField()
def __str__(self):
return self.hint_text
# Create your models here.

View File

@ -14,17 +14,12 @@
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
{% load static %}
<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=Poppins:wght@400;500;600;700&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
{% block head %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
{% block extra_js %}{% endblock %}
</body>
</html>

View File

@ -1,68 +1,13 @@
{% extends "base.html" %}
{% load static %}
{% extends 'base.html' %}
{% block title %}{{ article.title }}{% endblock %}
{% block content %}
<style>
body {
background-color: #f8f9fa;
}
.article-container {
max-width: 800px;
margin: 40px auto;
padding: 40px;
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.article-header h1 {
font-weight: 700;
margin-bottom: 0.5rem;
}
.article-header .text-muted {
margin-bottom: 2rem;
}
.article-content {
line-height: 1.8;
font-size: 1.1rem;
}
.article-content h2, .article-content h3 {
font-weight: 600;
margin-top: 2rem;
margin-bottom: 1rem;
}
.article-content img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin: 1.5rem 0;
}
</style>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'core:student_dashboard' %}">Student Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="{% url 'core:student_dashboard' %}">Back to Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'core:logout' %}">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="article-container">
<header class="article-header text-center">
<h1>{{ article.title }}</h1>
<p class="text-muted">Published on {{ article.created_at|date:"F d, Y" }}</p>
</header>
<div class="article-content">
<div class="container mt-5">
<h1>{{ article.title }}</h1>
<p class="text-muted">Published on {{ article.created_at|date:"F d, Y" }}</p>
<hr>
<div>
{{ article.content|safe }}
</div>
</div>

View File

@ -1,133 +0,0 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<style>
body {
background-color: #f0f2f5;
}
.assignment-container {
padding: 40px;
max-width: 900px;
margin: auto;
}
.assignment-header {
margin-bottom: 32px;
padding-bottom: 24px;
border-bottom: 1px solid #dee2e6;
}
.assignment-header h2 {
font-weight: bold;
}
.exercise-card {
background: white;
border-radius: 12px;
padding: 24px;
margin-bottom: 24px;
box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.exercise-question {
font-size: 1.1rem;
margin-bottom: 16px;
}
.btn-primary {
background-color: #6a11cb;
border-color: #6a11cb;
}
.btn-secondary {
background-color: #566573;
border-color: #566573;
}
.hint-container {
background-color: #eaf2f8;
border-left: 4px solid #3498db;
padding: 16px;
margin-top: 16px;
border-radius: 4px;
}
</style>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="{% url 'core:student_dashboard' %}">Student Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="{% url 'core:student_dashboard' %}">Back to Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'core:logout' %}">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="assignment-container">
<header class="assignment-header">
<h2>{{ assignment.title }}</h2>
<p class="text-muted">{{ assignment.description }}</p>
</header>
{% for exercise in assignment.exercises.all %}
<div class="exercise-card">
<h4 class="border-bottom pb-2 mb-3">Exercise {{ forloop.counter }}</h4>
<p class="exercise-question">{{ exercise.question }}</p>
<form method="post" action="{% url 'core:assignment_detail' assignment.id %}">
{% csrf_token %}
<input type="hidden" name="exercise_id" value="{{ exercise.id }}">
<div class="form-group mb-3">
<textarea class="form-control" name="answer" rows="4" placeholder="Write your answer here..."></textarea>
</div>
<div class="d-flex justify-content-between align-items-center">
<button type="submit" class="btn btn-primary">Submit Answer</button>
<div>
<button type="button" class="btn btn-outline-secondary get-hint" data-exercise-id="{{ exercise.id }}"><i class="fas fa-lightbulb me-1"></i> Get a Hint</button>
<button type="button" class="btn btn-outline-danger call-teacher"><i class="fas fa-phone me-1"></i> Call Teacher</button>
</div>
</div>
</form>
<div class="hint-container mt-3" id="hint-for-{{ exercise.id }}" style="display: none;">
<div class="hint-text"></div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
{% block extra_js %}
<script>
document.addEventListener('DOMContentLoaded', function() {
const hintButtons = document.querySelectorAll('.get-hint');
hintButtons.forEach(button => {
button.addEventListener('click', function() {
const exerciseId = this.dataset.exerciseId;
fetch(`/hint/${exerciseId}/`)
.then(response => response.json())
.then(data => {
const hintContainer = document.querySelector(`#hint-for-${exerciseId}`);
const hintText = hintContainer.querySelector('.hint-text');
hintText.textContent = data.hint;
hintContainer.style.display = 'block';
});
});
});
const callTeacherButtons = document.querySelectorAll('.call-teacher');
callTeacherButtons.forEach(button => {
button.addEventListener('click', function() {
fetch(`/call-teacher/`)
.then(response => response.json())
.then(data => {
alert(data.message);
});
});
});
});
</script>
{% endblock %}

View File

@ -1,53 +1,145 @@
{% extends "base.html" %}
{% load static %}
{% block title %}CodeCraft - Your Coding Challenge Platform{% endblock %}
{% 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 %}
<div class="container-fluid">
<header class="hero">
<div class="container">
<div class="row">
<div class="col-md-8 mx-auto">
<h1 class="display-4">Welcome to CodeCraft</h1>
<p class="lead">The ultimate platform for coding challenges and assignments. Sharpen your skills, compete with peers, and get feedback from instructors.</p>
<div class="d-grid gap-2 d-sm-flex justify-content-sm-center">
<a href="{% url 'core:login' %}" class="btn btn-primary btn-lg">Student Portal</a>
<a href="#" class="btn btn-secondary btn-lg">Teacher Login</a>
</div>
</div>
</div>
<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>
</div>
</header>
<section class="features-section">
<div class="container">
<div class="row text-center">
<div class="col-lg-4 mb-4">
<div class="feature-card h-100">
<div class="icon"><i class="fas fa-tasks"></i></div>
<h3 class="h4">Diverse Challenges</h3>
<p>From simple algorithms to complex data structures, we have a wide range of challenges to test your skills.</p>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="feature-card h-100">
<div class="icon"><i class="fas fa-lightbulb"></i></div>
<h3 class="h4">Hint System</h3>
<p>Stuck on a problem? Our hint system will guide you towards the solution without giving it away.</p>
</div>
</div>
<div class="col-lg-4 mb-4">
<div class="feature-card h-100">
<div class="icon"><i class="fas fa-chalkboard-teacher"></i></div>
<h3 class="h4">Instructor Support</h3>
<p>Teachers can create assignments, provide feedback, and even queue up to help students in real-time.</p>
</div>
</div>
</div>
</div>
</section>
</div>
{% endblock %}
<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 %}

View File

@ -1,93 +0,0 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<style>
.login-page {
display: flex;
align-items: center;
justify-content: center;
min-height: 80vh;
background-color: #f8f9fa;
}
.login-container {
display: flex;
width: 100%;
max-width: 900px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
border-radius: 12px;
overflow: hidden;
}
.login-branding {
background: linear-gradient(to right, #6a11cb, #2575fc);
color: white;
padding: 40px;
width: 45%;
display: flex;
flex-direction: column;
justify-content: center;
}
.login-branding h1 {
font-size: 2.5rem;
font-weight: bold;
margin-bottom: 1rem;
}
.login-form-wrapper {
background: white;
padding: 40px;
width: 55%;
}
.form-control {
height: 48px;
border-radius: 8px;
}
.btn-primary {
background-color: #6a11cb;
border-color: #6a11cb;
padding: 12px;
border-radius: 8px;
font-weight: bold;
}
</style>
<div class="login-page">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10">
<div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-body p-0">
<div class="row m-0">
<div class="col-lg-6 d-none d-lg-flex align-items-center justify-content-center bg-primary text-white flex-column p-5" style="border-top-left-radius: 0.5rem; border-bottom-left-radius: 0.5rem;">
<h1 class="h2 font-weight-bold">Welcome Back</h1>
<p class="text-white-75">Sign in to access your student dashboard and continue your learning journey.</p>
</div>
<div class="col-lg-6 p-5">
<h3 class="font-weight-light mb-4">Student Login</h3>
<form method="post">
{% csrf_token %}
<div class="form-group mb-3">
{{ form.username.label_tag }}
<input type="text" name="username" class="form-control" placeholder="Enter your username">
</div>
<div class="form-group mb-4">
{{ form.password.label_tag }}
<input type="password" name="password" class="form-control" placeholder="Enter your password">
</div>
{% if form.errors %}
<div class="alert alert-danger mb-3">
Your username and password didn't match. Please try again.
</div>
{% endif %}
<button type="submit" class="btn btn-primary btn-block w-100">Sign In</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,105 +0,0 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
<style>
body {
background-color: #f0f2f5;
}
.dashboard-container {
padding: 40px;
}
.header {
margin-bottom: 40px;
}
.header h2 {
font-weight: bold;
}
.assignment-card {
background-color: white;
border-radius: 12px;
padding: 24px;
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
transition: transform 0.2s;
margin-bottom: 24px;
}
.assignment-card:hover {
transform: translateY(-5px);
}
.assignment-title {
font-weight: 600;
margin-bottom: 8px;
}
.assignment-due-date {
color: #6c757d;
font-size: 0.9rem;
}
.btn-primary {
background-color: #6a11cb;
border-color: #6a11cb;
}
.empty-state {
text-align: center;
padding: 40px;
background-color: white;
border-radius: 12px;
}
</style>
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
<div class="container-fluid">
<a class="navbar-brand" href="#">Student Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ms-auto">
<li class="nav-item">
<a class="nav-link" href="#">Courses</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Grades</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ user.username }}
</a>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="#">Profile</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'core:logout' %}">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="dashboard-container">
<header class="header">
<h2>Welcome, {{ user.username }}!</h2>
<p class="text-muted">Here are your current assignments. Stay on track!</p>
</header>
<div class="row">
{% for assignment in assignments %}
<div class="col-md-6 col-lg-4">
<div class="assignment-card">
<h5 class="assignment-title">{{ assignment.title }}</h5>
<p class="assignment-due-date">Due: {{ assignment.due_date|date:"M d, Y" }}</p>
<p>{{ assignment.description|truncatewords:15 }}</p>
<a href="{% url 'core:assignment_detail' assignment.id %}" class="btn btn-primary">View Details</a>
</div>
</div>
{% empty %}
<div class="col-12">
<div class="empty-state">
<i class="fas fa-check-circle fa-3x text-success mb-3"></i>
<h4>You're all caught up!</h4>
<p class="text-muted">No pending assignments at the moment. Great job!</p>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}

View File

@ -1,23 +1,7 @@
from django.urls import path
from .views import (
home,
student_dashboard,
assignment_detail,
get_hint,
call_teacher,
login_view,
logout_view,
)
app_name = "core"
from .views import home
urlpatterns = [
path("", home, name="home"),
path("login/", login_view, name="login"),
path("logout/", logout_view, name="logout"),
path("dashboard/", student_dashboard, name="student_dashboard"),
path("assignment/<int:assignment_id>/", assignment_detail, name="assignment_detail"),
path("hint/<int:exercise_id>/", get_hint, name="get_hint"),
path("call-teacher/", call_teacher, name="call_teacher"),
]

View File

@ -1,17 +1,10 @@
import os
import platform
import random
from django import get_version as django_version
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.http import JsonResponse
from django.shortcuts import render, get_object_or_404, redirect
from django.shortcuts import render
from django.utils import timezone
from .models import Assignment, Exercise, Hint, Submission
def home(request):
"""Render the landing screen with loader and environment details."""
@ -30,73 +23,3 @@ def home(request):
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
}
return render(request, "core/index.html", context)
def login_view(request):
if request.method == 'POST':
form = AuthenticationForm(request, data=request.POST)
if form.is_valid():
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password')
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
return redirect('core:student_dashboard')
else:
form = AuthenticationForm()
return render(request, 'core/login.html', {'form': form})
def logout_view(request):
logout(request)
return redirect('core:login')
@login_required
def student_dashboard(request):
assignments = Assignment.objects.all()
return render(request, "core/student_dashboard.html", {"assignments": assignments})
@login_required
def assignment_detail(request, assignment_id):
assignment = get_object_or_404(Assignment, pk=assignment_id)
if request.method == 'POST':
exercise_id = request.POST.get('exercise_id')
submitted_answer = request.POST.get('answer')
exercise = get_object_or_404(Exercise, pk=exercise_id)
submission, created = Submission.objects.get_or_create(
exercise=exercise,
student=request.user,
defaults={'submitted_answer': submitted_answer}
)
if not created:
submission.submitted_answer = submitted_answer
submission.save()
if submission.submitted_answer.lower() == exercise.answer.lower():
submission.is_correct = True
submission.save()
# You might want to add a message here
else:
submission.is_correct = False
submission.save()
return render(request, "core/assignment_detail.html", {"assignment": assignment})
@login_required
def get_hint(request, exercise_id):
exercise = get_object_or_404(Exercise, pk=exercise_id)
hints = exercise.hints.all()
if hints:
hint = random.choice(hints)
return JsonResponse({'hint': hint.hint_text})
return JsonResponse({'hint': 'No hints available for this exercise.'})
@login_required
def call_teacher(request):
# In a real application, this would trigger a notification to the teacher
return JsonResponse({'message': 'A teacher has been called to help you.'})

View File

@ -1,62 +0,0 @@
from django.contrib.auth.models import User
from core.models import Assignment, Exercise, Hint
from datetime import datetime, timedelta
# Create a student user
student, created = User.objects.get_or_create(username='student', defaults={'first_name': 'John', 'last_name': 'Doe'})
if created:
student.set_password('password')
student.save()
print("Student user created.")
else:
print("Student user already exists.")
# Create an assignment
assignment, created = Assignment.objects.get_or_create(
title='Math Homework 1',
defaults={
'description': 'Complete the following exercises.',
'due_date': datetime.now() + timedelta(days=7)
}
)
if created:
print("Assignment created.")
else:
print("Assignment already exists.")
# Create exercises
exercise1, created = Exercise.objects.get_or_create(
assignment=assignment,
question='What is 2 + 2?',
defaults={'answer': '4'}
)
if created:
print("Exercise 1 created.")
else:
print("Exercise 1 already exists.")
exercise2, created = Exercise.objects.get_or_create(
assignment=assignment,
question='What is 5 * 5?',
defaults={'answer': '25'}
)
if created:
print("Exercise 2 created.")
else:
print("Exercise 2 already exists.")
# Create a hint
hint, created = Hint.objects.get_or_create(
exercise=exercise1,
defaults={'hint_text': 'The answer is a single digit number.'}
)
if created:
print("Hint created.")
else:
print("Hint already exists.")
print("Dummy data creation complete.")

View File

@ -1,400 +1,4 @@
/* Custom styles for the application */
:root {
--primary-color: #4285F4;
--secondary-color: #FBBC05;
--accent-color: #34A853;
--tertiary-color: #EA4335;
--neutral-light-gray: #F8F9FA;
--neutral-dark-text: #202124;
--font-headings: 'Poppins', sans-serif;
--font-body: 'Roboto', sans-serif;
}
body {
font-family: var(--font-body);
color: var(--neutral-dark-text);
background-color: var(--neutral-light-gray);
line-height: 1.6;
font-family: system-ui, -apple-system, sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-headings);
font-weight: 700;
}
.btn {
font-family: var(--font-headings);
font-weight: 600;
border-radius: 8px;
padding: 12px 28px;
text-transform: uppercase;
letter-spacing: 1px;
transition: all 0.3s ease;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: #fff;
}
.btn-primary:hover {
background-color: #3367D6;
border-color: #3367D6;
}
.btn-secondary {
background-color: var(--secondary-color);
border-color: var(--secondary-color);
color: var(--neutral-dark-text);
}
.btn-secondary:hover {
background-color: #F9A825;
border-color: #F9A825;
}
.btn-tertiary {
background-color: var(--tertiary-color);
border-color: var(--tertiary-color);
color: #fff;
}
.btn-tertiary:hover {
background-color: #D93025;
border-color: #D93025;
}
.login-container {
display: grid;
grid-template-columns: 1fr 1fr;
min-height: 100vh;
width: 100%;
}
.login-branding {
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
color: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
text-align: center;
}
.login-branding-content h1 {
font-size: 2.8rem;
font-weight: 700;
margin-bottom: 20px;
}
.login-branding-content p {
font-size: 1.1rem;
max-width: 400px;
margin: 0 auto;
}
.login-form-wrapper {
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
background-color: #fff;
}
.login-form-container {
max-width: 400px;
width: 100%;
}
.login-form-container h2 {
font-size: 2rem;
font-weight: 700;
margin-bottom: 10px;
color: var(--neutral-dark-text);
}
.login-form {
margin-top: 30px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: 600;
margin-bottom: 8px;
color: var(--neutral-dark-text);
}
.form-group input, .form-group textarea {
width: 100%;
padding: 12px 15px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}
.btn-block {
width: 100%;
padding: 15px;
font-size: 1rem;
}
.login-form-footer {
text-align: center;
margin-top: 20px;
font-size: 0.9rem;
}
/* Student Dashboard */
.dashboard-container {
display: flex;
min-height: 100vh;
}
.sidebar {
width: 260px;
background-color: var(--neutral-dark-text);
color: #fff;
display: flex;
flex-direction: column;
position: fixed;
height: 100%;
}
.sidebar-header {
padding: 25px 20px;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h3 {
color: #fff;
font-weight: 600;
}
.sidebar-nav {
flex-grow: 1;
}
.sidebar-nav a {
display: block;
padding: 15px 20px;
color: #fff;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
background-color: rgba(255,255,255,0.1);
}
.sidebar-nav a i {
margin-right: 15px;
width: 20px;
text-align: center;
}
.sidebar-footer {
padding: 20px;
border-top: 1px solid rgba(255,255,255,0.1);
}
.logout-btn {
display: block;
text-align: center;
background-color: var(--primary-color);
color: #fff;
padding: 10px;
border-radius: 8px;
text-decoration: none;
font-weight: 600;
transition: background-color 0.3s ease;
}
.logout-btn:hover {
background-color: #3367D6;
}
.main-content {
margin-left: 260px;
flex-grow: 1;
background-color: var(--neutral-light-gray);
padding: 30px;
}
.header {
background-color: #fff;
padding: 30px;
border-radius: 12px;
margin-bottom: 30px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.header h2 {
font-size: 2.2rem;
margin-bottom: 5px;
}
.assignments-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 25px;
}
.assignment-card {
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.assignment-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.assignment-card-header {
padding: 20px;
border-bottom: 1px solid #eee;
}
.assignment-title {
font-size: 1.2rem;
font-weight: 600;
margin-bottom: 0;
}
.assignment-due-date {
font-size: 0.85rem;
color: #5f6368;
}
.assignment-card-body {
padding: 20px;
flex-grow: 1;
}
.assignment-card-footer {
padding: 0 20px 20px;
}
.empty-state {
grid-column: 1 / -1;
text-align: center;
padding: 60px 20px;
background-color: #fff;
border-radius: 12px;
}
.empty-state i {
font-size: 4rem;
color: var(--accent-color);
margin-bottom: 20px;
}
.empty-state h4 {
font-size: 1.5rem;
margin-bottom: 10px;
}
/* Assignment Detail */
.exercises-section {
max-width: 900px;
}
.exercise-list {
display: flex;
flex-direction: column;
gap: 30px;
}
.exercise-card {
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.exercise-card-header {
padding: 20px;
border-bottom: 1px solid #eee;
background-color: #fafafa;
}
.exercise-card-header h4 {
margin: 0;
font-size: 1.3rem;
}
.exercise-card-body {
padding: 25px;
}
.exercise-question {
font-size: 1.1rem;
margin-bottom: 25px;
}
.exercise-actions {
margin-top: 20px;
display: flex;
gap: 15px;
flex-wrap: wrap;
}
.hint-container .alert {
margin-top: 20px;
}
/* Responsive adjustments */
@media (max-width: 992px) {
.login-container {
grid-template-columns: 1fr;
}
.login-branding {
display: none;
}
.login-form-wrapper {
padding: 20px;
}
.sidebar {
position: static;
width: 100%;
height: auto;
flex-direction: row;
align-items: center;
}
.main-content {
margin-left: 0;
}
.sidebar-header {
display: none;
}
.sidebar-nav {
display: flex;
flex-grow: 1;
justify-content: space-around;
}
.sidebar-footer {
display: none; /* Or adjust to a dropdown menu */
}
}

View File

@ -1,400 +1,21 @@
/* Custom styles for the application */
:root {
--primary-color: #4285F4;
--secondary-color: #FBBC05;
--accent-color: #34A853;
--tertiary-color: #EA4335;
--neutral-light-gray: #F8F9FA;
--neutral-dark-text: #202124;
--font-headings: 'Poppins', sans-serif;
--font-body: 'Roboto', sans-serif;
--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);
}
body {
font-family: var(--font-body);
color: var(--neutral-dark-text);
background-color: var(--neutral-light-gray);
line-height: 1.6;
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-headings);
font-weight: 700;
}
.btn {
font-family: var(--font-headings);
font-weight: 600;
border-radius: 8px;
padding: 12px 28px;
text-transform: uppercase;
letter-spacing: 1px;
transition: all 0.3s ease;
}
.btn-primary {
background-color: var(--primary-color);
border-color: var(--primary-color);
color: #fff;
}
.btn-primary:hover {
background-color: #3367D6;
border-color: #3367D6;
}
.btn-secondary {
background-color: var(--secondary-color);
border-color: var(--secondary-color);
color: var(--neutral-dark-text);
}
.btn-secondary:hover {
background-color: #F9A825;
border-color: #F9A825;
}
.btn-tertiary {
background-color: var(--tertiary-color);
border-color: var(--tertiary-color);
color: #fff;
}
.btn-tertiary:hover {
background-color: #D93025;
border-color: #D93025;
}
.login-container {
display: grid;
grid-template-columns: 1fr 1fr;
min-height: 100vh;
width: 100%;
}
.login-branding {
background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
color: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
text-align: center;
}
.login-branding-content h1 {
font-size: 2.8rem;
font-weight: 700;
margin-bottom: 20px;
}
.login-branding-content p {
font-size: 1.1rem;
max-width: 400px;
margin: 0 auto;
}
.login-form-wrapper {
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
background-color: #fff;
}
.login-form-container {
max-width: 400px;
width: 100%;
}
.login-form-container h2 {
font-size: 2rem;
font-weight: 700;
margin-bottom: 10px;
color: var(--neutral-dark-text);
}
.login-form {
margin-top: 30px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-weight: 600;
margin-bottom: 8px;
color: var(--neutral-dark-text);
}
.form-group input, .form-group textarea {
width: 100%;
padding: 12px 15px;
border: 1px solid #ccc;
border-radius: 8px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.form-group input:focus, .form-group textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}
.btn-block {
width: 100%;
padding: 15px;
font-size: 1rem;
}
.login-form-footer {
text-align: center;
margin-top: 20px;
font-size: 0.9rem;
}
/* Student Dashboard */
.dashboard-container {
display: flex;
min-height: 100vh;
}
.sidebar {
width: 260px;
background-color: var(--neutral-dark-text);
color: #fff;
display: flex;
flex-direction: column;
position: fixed;
height: 100%;
}
.sidebar-header {
padding: 25px 20px;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h3 {
color: #fff;
font-weight: 600;
}
.sidebar-nav {
flex-grow: 1;
}
.sidebar-nav a {
display: block;
padding: 15px 20px;
color: #fff;
text-decoration: none;
font-weight: 500;
transition: background-color 0.3s ease;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
background-color: rgba(255,255,255,0.1);
}
.sidebar-nav a i {
margin-right: 15px;
width: 20px;
text-align: center;
}
.sidebar-footer {
padding: 20px;
border-top: 1px solid rgba(255,255,255,0.1);
}
.logout-btn {
display: block;
text-align: center;
background-color: var(--primary-color);
color: #fff;
padding: 10px;
border-radius: 8px;
text-decoration: none;
font-weight: 600;
transition: background-color 0.3s ease;
}
.logout-btn:hover {
background-color: #3367D6;
}
.main-content {
margin-left: 260px;
flex-grow: 1;
background-color: var(--neutral-light-gray);
padding: 30px;
}
.header {
background-color: #fff;
padding: 30px;
border-radius: 12px;
margin-bottom: 30px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.header h2 {
font-size: 2.2rem;
margin-bottom: 5px;
}
.assignments-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 25px;
}
.assignment-card {
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
display: flex;
flex-direction: column;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.assignment-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.assignment-card-header {
padding: 20px;
border-bottom: 1px solid #eee;
}
.assignment-title {
font-size: 1.2rem;
font-weight: 600;
margin-bottom: 0;
}
.assignment-due-date {
font-size: 0.85rem;
color: #5f6368;
}
.assignment-card-body {
padding: 20px;
flex-grow: 1;
}
.assignment-card-footer {
padding: 0 20px 20px;
}
.empty-state {
grid-column: 1 / -1;
text-align: center;
padding: 60px 20px;
background-color: #fff;
border-radius: 12px;
}
.empty-state i {
font-size: 4rem;
color: var(--accent-color);
margin-bottom: 20px;
}
.empty-state h4 {
font-size: 1.5rem;
margin-bottom: 10px;
}
/* Assignment Detail */
.exercises-section {
max-width: 900px;
}
.exercise-list {
display: flex;
flex-direction: column;
gap: 30px;
}
.exercise-card {
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.exercise-card-header {
padding: 20px;
border-bottom: 1px solid #eee;
background-color: #fafafa;
}
.exercise-card-header h4 {
margin: 0;
font-size: 1.3rem;
}
.exercise-card-body {
padding: 25px;
}
.exercise-question {
font-size: 1.1rem;
margin-bottom: 25px;
}
.exercise-actions {
margin-top: 20px;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
gap: 15px;
flex-wrap: wrap;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
.hint-container .alert {
margin-top: 20px;
}
/* Responsive adjustments */
@media (max-width: 992px) {
.login-container {
grid-template-columns: 1fr;
}
.login-branding {
display: none;
}
.login-form-wrapper {
padding: 20px;
}
.sidebar {
position: static;
width: 100%;
height: auto;
flex-direction: row;
align-items: center;
}
.main-content {
margin-left: 0;
}
.sidebar-header {
display: none;
}
.sidebar-nav {
display: flex;
flex-grow: 1;
justify-content: space-around;
}
.sidebar-footer {
display: none; /* Or adjust to a dropdown menu */
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB