1.1.0
This commit is contained in:
parent
4a4f6a59ca
commit
e4e980bd92
Binary file not shown.
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,15 @@
|
||||
from django.contrib import admin
|
||||
from .models import Achievement
|
||||
from .models import Achievement, Proposal
|
||||
|
||||
admin.site.register(Achievement)
|
||||
@admin.register(Achievement)
|
||||
class AchievementAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'student_name', 'event_name', 'achievement_level', 'date')
|
||||
list_filter = ('date', 'achievement_level')
|
||||
search_fields = ('title', 'student_name', 'event_name')
|
||||
|
||||
@admin.register(Proposal)
|
||||
class ProposalAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'proposer_name', 'proposal_type', 'status', 'submitted_at')
|
||||
list_filter = ('status', 'proposal_type', 'submitted_at')
|
||||
search_fields = ('title', 'proposer_name')
|
||||
readonly_fields = ('submitted_at',)
|
||||
17
core/forms.py
Normal file
17
core/forms.py
Normal file
@ -0,0 +1,17 @@
|
||||
from django import forms
|
||||
from .models import Proposal
|
||||
|
||||
class ProposalForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Proposal
|
||||
fields = ['title', 'proposer_name', 'description', 'proposal_type', 'attachment']
|
||||
widgets = {
|
||||
'title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Judul Proposal'}),
|
||||
'proposer_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Nama Anda/Tim/Lembaga'}),
|
||||
'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 5, 'placeholder': 'Jelaskan secara singkat isi proposal Anda'}),
|
||||
'proposal_type': forms.Select(attrs={'class': 'form-select'}),
|
||||
'attachment': forms.FileInput(attrs={'class': 'form-control'}),
|
||||
}
|
||||
help_texts = {
|
||||
'attachment': 'File dalam format PDF atau Word (.docx).',
|
||||
}
|
||||
39
core/migrations/0001_initial.py
Normal file
39
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,39 @@
|
||||
# Generated by Django 5.2.7 on 2025-11-03 14:36
|
||||
|
||||
import django.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Achievement',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200)),
|
||||
('student_name', models.CharField(max_length=100)),
|
||||
('event_name', models.CharField(max_length=200)),
|
||||
('achievement_level', models.CharField(max_length=100)),
|
||||
('date', models.DateField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Proposal',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=200)),
|
||||
('proposer_name', models.CharField(help_text='Nama perorangan, kelompok, atau lembaga', max_length=100)),
|
||||
('description', models.TextField()),
|
||||
('proposal_type', models.CharField(choices=[('lomba', 'Lomba'), ('non_lomba', 'Non-Lomba')], default='lomba', max_length=20)),
|
||||
('status', models.CharField(choices=[('pending', 'Pending'), ('approved_dosen', 'Approved by Dosen'), ('approved_fakultas', 'Approved by Fakultas'), ('approved_universitas', 'Approved by Universitas'), ('rejected', 'Rejected'), ('completed', 'Completed')], default='pending', max_length=20)),
|
||||
('submitted_at', models.DateTimeField(default=django.utils.timezone.now)),
|
||||
('attachment', models.FileField(blank=True, help_text='Dokumen proposal (PDF, DOCX)', null=True, upload_to='proposals/')),
|
||||
],
|
||||
),
|
||||
]
|
||||
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.
@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
class Achievement(models.Model):
|
||||
title = models.CharField(max_length=200)
|
||||
@ -8,4 +9,30 @@ class Achievement(models.Model):
|
||||
date = models.DateField()
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
return self.title
|
||||
|
||||
class Proposal(models.Model):
|
||||
STATUS_CHOICES = [
|
||||
('pending', 'Pending'),
|
||||
('approved_dosen', 'Approved by Dosen'),
|
||||
('approved_fakultas', 'Approved by Fakultas'),
|
||||
('approved_universitas', 'Approved by Universitas'),
|
||||
('rejected', 'Rejected'),
|
||||
('completed', 'Completed'),
|
||||
]
|
||||
|
||||
PROPOSAL_TYPE_CHOICES = [
|
||||
('lomba', 'Lomba'),
|
||||
('non_lomba', 'Non-Lomba'),
|
||||
]
|
||||
|
||||
title = models.CharField(max_length=200)
|
||||
proposer_name = models.CharField(max_length=100, help_text="Nama perorangan, kelompok, atau lembaga")
|
||||
description = models.TextField()
|
||||
proposal_type = models.CharField(max_length=20, choices=PROPOSAL_TYPE_CHOICES, default='lomba')
|
||||
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending')
|
||||
submitted_at = models.DateTimeField(default=timezone.now)
|
||||
attachment = models.FileField(upload_to='proposals/', blank=True, null=True, help_text="Dokumen proposal (PDF, DOCX)")
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} by {self.proposer_name}"
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
<div class="container text-center">
|
||||
<h1 class="hero-title">Sistem Informasi Prestasi Mahasiswa</h1>
|
||||
<p class="hero-subtitle">Wadah untuk mencatat, mengelola, dan mempublikasikan prestasi mahasiswa.</p>
|
||||
<a href="#" class="btn btn-lg btn-accent">Ajukan Proposal <i class="fas fa-arrow-right ms-2"></i></a>
|
||||
<a href="{% url 'submit_proposal' %}" class="btn btn-lg btn-accent">Ajukan Proposal <i class="fas fa-arrow-right ms-2"></i></a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
22
core/templates/core/proposal_success.html
Normal file
22
core/templates/core/proposal_success.html
Normal file
@ -0,0 +1,22 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Proposal Terkirim - {{ block.super }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-5 text-center">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body p-5">
|
||||
<h1 class="display-4 text-primary">Terima Kasih!</h1>
|
||||
<p class="lead">Proposal Anda telah berhasil dikirim.</p>
|
||||
<hr class="my-4">
|
||||
<p>Tim kami akan segera meninjau pengajuan Anda. Anda akan menerima notifikasi lebih lanjut mengenai status proposal Anda.</p>
|
||||
<a class="btn btn-primary btn-lg mt-3" href="{% url 'index' %}" role="button">Kembali ke Halaman Utama</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
55
core/templates/core/submit_proposal.html
Normal file
55
core/templates/core/submit_proposal.html
Normal file
@ -0,0 +1,55 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Ajukan Proposal - {{ block.super }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container my-5">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-8">
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-body p-5">
|
||||
<h1 class="card-title text-center mb-4">Formulir Pengajuan Proposal</h1>
|
||||
<p class="text-center text-muted mb-5">Silakan isi detail proposal Anda di bawah ini. Tim kami akan segera meninjaunya.</p>
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ form.title.id_for_label }}" class="form-label">{{ form.title.label }}</label>
|
||||
{{ form.title }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ form.proposer_name.id_for_label }}" class="form-label">{{ form.proposer_name.label }}</label>
|
||||
{{ form.proposer_name }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ form.proposal_type.id_for_label }}" class="form-label">{{ form.proposal_type.label }}</label>
|
||||
{{ form.proposal_type }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ form.description.id_for_label }}" class="form-label">{{ form.description.label }}</label>
|
||||
{{ form.description }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<label for="{{ form.attachment.id_for_label }}" class="form-label">{{ form.attachment.label }}</label>
|
||||
{{ form.attachment }}
|
||||
{% if form.attachment.help_text %}
|
||||
<div class="form-text">{{ form.attachment.help_text }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2">
|
||||
<button type="submit" class="btn btn-primary btn-lg">Kirim Proposal</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@ -1,7 +1,8 @@
|
||||
from django.urls import path
|
||||
|
||||
from .views import home
|
||||
from .views import index, submit_proposal, proposal_success
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
path("", index, name="index"),
|
||||
path("submit-proposal/", submit_proposal, name="submit_proposal"),
|
||||
path("proposal-success/", proposal_success, name="proposal_success"),
|
||||
]
|
||||
|
||||
@ -1,9 +1,27 @@
|
||||
from django.shortcuts import render
|
||||
from .models import Achievement
|
||||
from django.shortcuts import render, redirect
|
||||
from .models import Achievement, Proposal
|
||||
from .forms import ProposalForm
|
||||
|
||||
def index(request):
|
||||
achievements = Achievement.objects.order_by('-date')[:6]
|
||||
context = {
|
||||
'achievements': achievements
|
||||
}
|
||||
return render(request, "core/index.html", context)
|
||||
return render(request, "core/index.html", context)
|
||||
|
||||
def submit_proposal(request):
|
||||
if request.method == 'POST':
|
||||
form = ProposalForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
return redirect('proposal_success')
|
||||
else:
|
||||
form = ProposalForm()
|
||||
|
||||
context = {
|
||||
'form': form
|
||||
}
|
||||
return render(request, 'core/submit_proposal.html', context)
|
||||
|
||||
def proposal_success(request):
|
||||
return render(request, 'core/proposal_success.html')
|
||||
Loading…
x
Reference in New Issue
Block a user