diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index 31f41f5..adba13e 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc new file mode 100644 index 0000000..8889a4c Binary files /dev/null and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index f101099..9a4989c 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..6b963d8 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 8cca099..82f451a 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 60d600c..fc5a24d 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,4 +1,15 @@ from django.contrib import admin -from .models import Achievement +from .models import Achievement, Proposal -admin.site.register(Achievement) \ No newline at end of file +@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',) \ No newline at end of file diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..e93b971 --- /dev/null +++ b/core/forms.py @@ -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).', + } diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..4be4371 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -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/')), + ], + ), + ] 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..7f30b4c 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 8e78a89..622ac9e 100644 --- a/core/models.py +++ b/core/models.py @@ -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 \ No newline at end of file + 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}" diff --git a/core/templates/core/index.html b/core/templates/core/index.html index c6a1288..1d15bbd 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -9,7 +9,7 @@
Wadah untuk mencatat, mengelola, dan mempublikasikan prestasi mahasiswa.
- Ajukan Proposal + Ajukan ProposalProposal Anda telah berhasil dikirim.
+Tim kami akan segera meninjau pengajuan Anda. Anda akan menerima notifikasi lebih lanjut mengenai status proposal Anda.
+ Kembali ke Halaman Utama +Silakan isi detail proposal Anda di bawah ini. Tim kami akan segera meninjaunya.
+ + +