Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
01e34b8bfc Beta v1.1.0 2025-12-16 09:52:29 +00:00
15 changed files with 376 additions and 185 deletions

View File

@ -1,3 +1,4 @@
from django.contrib import admin
from .models import Problem
# Register your models here.
admin.site.register(Problem)

View File

@ -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)),
],
),
]

View File

@ -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

View File

@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Knowledge Base{% endblock %}</title>
<title>{% block title %}Test Management{% endblock %}</title>
{% if project_description %}
<meta name="description" content="{{ project_description }}">
<meta property="og:description" content="{{ project_description }}">
@ -13,6 +13,9 @@
<meta property="og:image" content="{{ project_image_url }}">
<meta property="twitter:image" content="{{ project_image_url }}">
{% endif %}
<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;600&family=Roboto:wght@400;500&display=swap" rel="stylesheet">
{% load static %}
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
{% block head %}{% endblock %}

View File

@ -1,14 +1,36 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ article.title }}{% endblock %}
{% block title %}{{ problem.title }}{% endblock %}
{% block 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 class="card">
<div class="card-header">
<h1>{{ problem.title }}</h1>
</div>
<div class="card-body">
<h5 class="card-title">Author: {{ problem.author }}</h5>
<p class="card-text"><strong>Level:</strong> {{ problem.level|title }}</p>
<p class="card-text"><strong>Type:</strong> {{ problem.type|title }}</p>
<p class="card-text"><strong>Supported Languages:</strong> {{ problem.supported_languages }}</p>
<p class="card-text"><strong>Memory Limit:</strong> {{ problem.memory_limit }} MB</p>
<p class="card-text"><strong>Time Limit:</strong> {{ problem.time_limit }} seconds</p>
<p class="card-text"><strong>Points:</strong> {{ problem.point }}</p>
<hr>
<h4>Description</h4>
<p>{{ problem.description }}</p>
<hr>
<h4>Input and Output Methods</h4>
<p>{{ problem.input_and_output_methods }}</p>
</div>
<div class="card-footer text-muted">
Created on {{ problem.created_day|date:"F d, Y" }}
{% if problem.access_code %}
| <strong>Access Code:</strong> {{ problem.access_code }}
{% endif %}
</div>
</div>
<a href="{% url 'core:index' %}" class="btn btn-primary mt-3">Back to Problems</a>
</div>
{% endblock %}
{% endblock %}

View File

@ -1,145 +1,45 @@
{% extends "base.html" %}
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ project_name }}{% endblock %}
{% block title %}Test Dashboard{% 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>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
{% endblock %}
{% block content %}
<main>
<div class="card">
<h1>Analyzing your requirements and generating your app…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
<nav class="navbar">
<a class="navbar-brand" href="#">ContestManager</a>
<div>
<a href="/admin" class="btn btn-outline-primary">Admin</a>
</div>
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
<p class="runtime">
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
</p>
</div>
</main>
<footer>
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
</footer>
{% endblock %}
</nav>
<div class="hero">
<h1>Test Management Dashboard</h1>
<p>Welcome, Admin. Manage and review programming problems.</p>
</div>
<div class="container mt-5">
<h2>Available Problems</h2>
{% if problems %}
<div class="problem-grid mt-4">
{% for problem in problems %}
<div class="problem-card">
<h3>{{ problem.title }}</h3>
<div class="problem-meta">
<span><strong>Author:</strong> {{ problem.author }}</span>
<span class="level-badge level-{{ problem.level|lower }}">{{ problem.level }}</span>
</div>
<p class="mt-3">{{ problem.description|truncatewords:20 }}</p>
<a href="{% url 'core:problem_detail' problem.pk %}" class="btn btn-sm btn-primary">View Details</a>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center p-5">
<p>No problems found. <a href="/admin/core/problem/add/">Add a new problem</a> in the admin panel to get started.</p>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -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/<int:pk>/", problem_detail, name="problem_detail"),
]

View File

@ -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)

View File

@ -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;
}

View File

@ -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;
}