diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index cd6f855..adac93c 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 9aa598b..86dcd6d 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 1f807fa..c8f23fd 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 6867ddf..d4c00b6 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..c08b2ef 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,4 @@ from django.contrib import admin +from .models import Problem -# Register your models here. +admin.site.register(Problem) \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..1bf1d12 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,33 @@ +# Generated by Django 5.2.7 on 2025-12-15 14:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Problem', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('type', models.CharField(choices=[('contest', 'Contest'), ('practice', 'Practice')], default='contest', max_length=10)), + ('author', models.CharField(max_length=100)), + ('level', models.CharField(choices=[('easy', 'Easy'), ('medium', 'Medium'), ('hard', 'Hard')], default='easy', max_length=10)), + ('input_and_output_methods', models.TextField(blank=True, help_text='Describe Input and Output methods (IaOM)')), + ('access_code', models.CharField(blank=True, help_text='Optional code to access the problem', max_length=50)), + ('supported_languages', models.CharField(help_text='e.g., Python, C++, Java', max_length=255)), + ('description', models.TextField()), + ('memory_limit', models.IntegerField(help_text='Memory limit in MB')), + ('time_limit', models.IntegerField(help_text='Time limit in seconds')), + ('status', models.CharField(choices=[('draft', 'Draft'), ('published', 'Published')], default='draft', max_length=10)), + ('point', models.IntegerField(default=100)), + ('created_day', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..90ce5b6 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..51219e6 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,23 @@ from django.db import models -# Create your models here. +class Problem(models.Model): + title = models.CharField(max_length=255) + TYPE_CHOICES = [('contest', 'Contest'), ('practice', 'Practice')] + LEVEL_CHOICES = [('easy', 'Easy'), ('medium', 'Medium'), ('hard', 'Hard')] + STATUS_CHOICES = [('draft', 'Draft'), ('published', 'Published')] + + type = models.CharField(max_length=10, choices=TYPE_CHOICES, default='contest') + author = models.CharField(max_length=100) + level = models.CharField(max_length=10, choices=LEVEL_CHOICES, default='easy') + input_and_output_methods = models.TextField(blank=True, help_text="Describe Input and Output methods (IaOM)") + access_code = models.CharField(max_length=50, blank=True, help_text="Optional code to access the problem") + supported_languages = models.CharField(max_length=255, help_text="e.g., Python, C++, Java") + description = models.TextField() + memory_limit = models.IntegerField(help_text="Memory limit in MB") + time_limit = models.IntegerField(help_text="Time limit in seconds") + status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='draft') + point = models.IntegerField(default=100) + created_day = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.title \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..b78403f 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -3,7 +3,7 @@ - {% block title %}Knowledge Base{% endblock %} + {% block title %}Test Management{% endblock %} {% if project_description %} @@ -13,6 +13,9 @@ {% endif %} + + + {% load static %} {% block head %}{% endblock %} diff --git a/core/templates/core/article_detail.html b/core/templates/core/article_detail.html index 8820990..23f0639 100644 --- a/core/templates/core/article_detail.html +++ b/core/templates/core/article_detail.html @@ -1,14 +1,36 @@ {% extends 'base.html' %} +{% load static %} -{% block title %}{{ article.title }}{% endblock %} +{% block title %}{{ problem.title }}{% endblock %} {% block content %}
-

{{ article.title }}

-

Published on {{ article.created_at|date:"F d, Y" }}

-
-
- {{ article.content|safe }} +
+
+

{{ problem.title }}

+
+
+
Author: {{ problem.author }}
+

Level: {{ problem.level|title }}

+

Type: {{ problem.type|title }}

+

Supported Languages: {{ problem.supported_languages }}

+

Memory Limit: {{ problem.memory_limit }} MB

+

Time Limit: {{ problem.time_limit }} seconds

+

Points: {{ problem.point }}

+
+

Description

+

{{ problem.description }}

+
+

Input and Output Methods

+

{{ problem.input_and_output_methods }}

+
+
+ Back to Problems
-{% endblock %} +{% endblock %} \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..a01f4dd 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,45 @@ -{% extends "base.html" %} +{% extends 'base.html' %} +{% load static %} -{% block title %}{{ project_name }}{% endblock %} +{% block title %}Test Dashboard{% endblock %} {% block head %} - - - - + {% endblock %} {% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… +
-
- -{% endblock %} \ No newline at end of file + + +
+

Test Management Dashboard

+

Welcome, Admin. Manage and review programming problems.

+
+ +
+

Available Problems

+ {% if problems %} +
+ {% for problem in problems %} +
+

{{ problem.title }}

+
+ Author: {{ problem.author }} + {{ problem.level }} +
+

{{ problem.description|truncatewords:20 }}

+ View Details +
+ {% endfor %} +
+ {% else %} +
+

No problems found. Add a new problem in the admin panel to get started.

+
+ {% endif %} +
+{% endblock %} diff --git a/core/urls.py b/core/urls.py index 6299e3d..1b743e1 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,7 +1,10 @@ from django.urls import path -from .views import home +from .views import index, problem_detail + +app_name = "core" urlpatterns = [ - path("", home, name="home"), + path("", index, name="index"), + path("problem//", problem_detail, name="problem_detail"), ] diff --git a/core/views.py b/core/views.py index c9aed12..e42027b 100644 --- a/core/views.py +++ b/core/views.py @@ -1,25 +1,23 @@ 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, get_object_or_404 +from .models import Problem -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() - +def index(request): + problems = Problem.objects.filter(status='published') 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, + 'problems': problems, "project_description": os.getenv("PROJECT_DESCRIPTION", ""), "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), } return render(request, "core/index.html", context) + +def problem_detail(request, pk): + problem = get_object_or_404(Problem, pk=pk) + context = { + 'problem': problem, + "project_description": os.getenv("PROJECT_DESCRIPTION", ""), + "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), + } + return render(request, "core/article_detail.html", context) diff --git a/static/css/custom.css b/static/css/custom.css index 925f6ed..aa0b85e 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -1,4 +1,118 @@ -/* Custom styles for the application */ -body { - font-family: system-ui, -apple-system, sans-serif; +:root { + --primary-color: #1a237e; + --secondary-color: #ffab40; + --accent-color: #448aff; + --background-color: #f5f5f5; + --text-color: #212121; + --heading-font: 'Poppins', sans-serif; + --body-font: 'Roboto', sans-serif; } + +body { + font-family: var(--body-font); + background-color: var(--background-color); + color: var(--text-color); + margin: 0; + padding: 0; + line-height: 1.6; +} + +h1, h2, h3, h4, h5, h6 { + font-family: var(--heading-font); + color: var(--primary-color); +} + +.navbar { + background-color: #ffffff; + border-bottom: 1px solid #e0e0e0; + padding: 1rem 2rem; + display: flex; + justify-content: space-between; + align-items: center; +} + +.navbar-brand { + font-family: var(--heading-font); + font-weight: 600; + font-size: 1.5rem; + color: var(--primary-color); + text-decoration: none; +} + +.hero { + background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); + color: #ffffff; + padding: 4rem 2rem; + text-align: center; + border-bottom-left-radius: 30px; + border-bottom-right-radius: 30px; +} + +.hero h1 { + color: #ffffff; + font-size: 2.5rem; + margin-bottom: 0.5rem; +} + +.container { + max-width: 1200px; + margin: 2rem auto; + padding: 0 2rem; +} + +.problem-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + gap: 1.5rem; +} + +.problem-card { + background-color: #ffffff; + border-radius: 15px; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); + padding: 1.5rem; + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.problem-card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 12px rgba(0,0,0,0.15); +} + +.problem-card h3 { + margin-top: 0; + font-size: 1.25rem; +} + +.problem-meta { + font-size: 0.9rem; + color: #757575; +} + +.problem-meta span { + margin-right: 1rem; +} + +.level-badge { + display: inline-block; + padding: 0.25rem 0.75rem; + border-radius: 12px; + font-size: 0.8rem; + font-weight: 500; + text-transform: capitalize; +} + +.level-easy { + background-color: #e8f5e9; + color: #4caf50; +} + +.level-medium { + background-color: #fff3e0; + color: #ff9800; +} + +.level-hard { + background-color: #ffebee; + color: #f44336; +} \ No newline at end of file diff --git a/staticfiles/css/custom.css b/staticfiles/css/custom.css index 108056f..aa0b85e 100644 --- a/staticfiles/css/custom.css +++ b/staticfiles/css/custom.css @@ -1,21 +1,118 @@ - :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); + --primary-color: #1a237e; + --secondary-color: #ffab40; + --accent-color: #448aff; + --background-color: #f5f5f5; + --text-color: #212121; + --heading-font: 'Poppins', sans-serif; + --body-font: 'Roboto', sans-serif; } + body { - margin: 0; - font-family: 'Inter', sans-serif; - background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); + font-family: var(--body-font); + background-color: var(--background-color); color: var(--text-color); - display: flex; - justify-content: center; - align-items: center; - min-height: 100vh; - text-align: center; - overflow: hidden; - position: relative; + margin: 0; + padding: 0; + line-height: 1.6; } + +h1, h2, h3, h4, h5, h6 { + font-family: var(--heading-font); + color: var(--primary-color); +} + +.navbar { + background-color: #ffffff; + border-bottom: 1px solid #e0e0e0; + padding: 1rem 2rem; + display: flex; + justify-content: space-between; + align-items: center; +} + +.navbar-brand { + font-family: var(--heading-font); + font-weight: 600; + font-size: 1.5rem; + color: var(--primary-color); + text-decoration: none; +} + +.hero { + background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); + color: #ffffff; + padding: 4rem 2rem; + text-align: center; + border-bottom-left-radius: 30px; + border-bottom-right-radius: 30px; +} + +.hero h1 { + color: #ffffff; + font-size: 2.5rem; + margin-bottom: 0.5rem; +} + +.container { + max-width: 1200px; + margin: 2rem auto; + padding: 0 2rem; +} + +.problem-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + gap: 1.5rem; +} + +.problem-card { + background-color: #ffffff; + border-radius: 15px; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); + padding: 1.5rem; + transition: transform 0.3s ease, box-shadow 0.3s ease; +} + +.problem-card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 12px rgba(0,0,0,0.15); +} + +.problem-card h3 { + margin-top: 0; + font-size: 1.25rem; +} + +.problem-meta { + font-size: 0.9rem; + color: #757575; +} + +.problem-meta span { + margin-right: 1rem; +} + +.level-badge { + display: inline-block; + padding: 0.25rem 0.75rem; + border-radius: 12px; + font-size: 0.8rem; + font-weight: 500; + text-transform: capitalize; +} + +.level-easy { + background-color: #e8f5e9; + color: #4caf50; +} + +.level-medium { + background-color: #fff3e0; + color: #ff9800; +} + +.level-hard { + background-color: #ffebee; + color: #f44336; +} \ No newline at end of file