diff --git a/config/__pycache__/settings.cpython-311.pyc b/config/__pycache__/settings.cpython-311.pyc index 96bce55..439576c 100644 Binary files a/config/__pycache__/settings.cpython-311.pyc and b/config/__pycache__/settings.cpython-311.pyc differ diff --git a/config/__pycache__/urls.cpython-311.pyc b/config/__pycache__/urls.cpython-311.pyc index 0b85e94..fd844e6 100644 Binary files a/config/__pycache__/urls.cpython-311.pyc and b/config/__pycache__/urls.cpython-311.pyc differ diff --git a/config/settings.py b/config/settings.py index 291d043..53ba80a 100644 --- a/config/settings.py +++ b/config/settings.py @@ -180,3 +180,7 @@ if EMAIL_USE_SSL: # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +MEDIA_URL = 'media/' +MEDIA_ROOT = BASE_DIR / 'media' + diff --git a/config/urls.py b/config/urls.py index bcfc074..a0b2ff5 100644 --- a/config/urls.py +++ b/config/urls.py @@ -27,3 +27,8 @@ urlpatterns = [ if settings.DEBUG: urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets") urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +else: + # Always serve assets in this environment as they are stored in BASE_DIR / "assets" + urlpatterns += static("/assets/", document_root=settings.BASE_DIR / "assets") + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..a4f604c 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 e061640..e2681fe 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 5a69659..300fa03 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 2a36fd6..ad9e325 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..29f3fcb 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import Letter, Student -# Register your models here. +@admin.register(Letter) +class LetterAdmin(admin.ModelAdmin): + list_display = ('letter_number', 'subject', 'type', 'date', 'sender_receiver') + list_filter = ('type', 'date') + search_fields = ('letter_number', 'subject', 'sender_receiver') + +@admin.register(Student) +class StudentAdmin(admin.ModelAdmin): + list_display = ('nisn', 'full_name', 'gender', 'is_active') + list_filter = ('gender', 'is_active') + search_fields = ('nisn', 'full_name') \ 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..8b35b3a --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,45 @@ +# Generated by Django 5.2.7 on 2026-02-01 01:49 + +import django.utils.timezone +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Letter', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('type', models.CharField(choices=[('IN', 'Surat Masuk'), ('OUT', 'Surat Keluar')], default='IN', max_length=3)), + ('subject', models.CharField(max_length=255)), + ('letter_number', models.CharField(max_length=100, unique=True)), + ('date', models.DateField(default=django.utils.timezone.now)), + ('sender_receiver', models.CharField(help_text='Pengirim untuk Surat Masuk, Penerima untuk Surat Keluar', max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('file_attachment', models.FileField(blank=True, null=True, upload_to='letters/')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ], + ), + migrations.CreateModel( + name='Student', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('nisn', models.CharField(max_length=20, unique=True)), + ('full_name', models.CharField(max_length=255)), + ('gender', models.CharField(choices=[('M', 'Laki-laki'), ('F', 'Perempuan')], max_length=1)), + ('birth_place', models.CharField(max_length=100)), + ('birth_date', models.DateField()), + ('address', models.TextField()), + ('is_active', models.BooleanField(default=True)), + ('photo', models.ImageField(blank=True, null=True, upload_to='students/')), + ('created_at', 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..baea715 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..55f6696 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,40 @@ from django.db import models +from django.utils import timezone -# Create your models here. +class Letter(models.Model): + LETTER_TYPE_CHOICES = [ + ('IN', 'Surat Masuk'), + ('OUT', 'Surat Keluar'), + ] + + type = models.CharField(max_length=3, choices=LETTER_TYPE_CHOICES, default='IN') + subject = models.CharField(max_length=255) + letter_number = models.CharField(max_length=100, unique=True) + date = models.DateField(default=timezone.now) + sender_receiver = models.CharField(max_length=255, help_text="Pengirim untuk Surat Masuk, Penerima untuk Surat Keluar") + description = models.TextField(blank=True, null=True) + file_attachment = models.FileField(upload_to='letters/', blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + def __str__(self): + return f"[{self.get_type_display()}] {self.letter_number} - {self.subject}" + +class Student(models.Model): + GENDER_CHOICES = [ + ('M', 'Laki-laki'), + ('F', 'Perempuan'), + ] + + nisn = models.CharField(max_length=20, unique=True) + full_name = models.CharField(max_length=255) + gender = models.CharField(max_length=1, choices=GENDER_CHOICES) + birth_place = models.CharField(max_length=100) + birth_date = models.DateField() + address = models.TextField() + is_active = models.BooleanField(default=True) + photo = models.ImageField(upload_to='students/', blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.nisn} - {self.full_name}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..d3809c7 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,9 +1,11 @@ - - + +{% load static %}
-AppWizzy AI is collecting your requirements and applying the first changes.
-This page will refresh automatically as the plan is implemented.
-
- Runtime: Django {{ django_version }} · Python {{ python_version }}
- — UTC {{ current_time|date:"Y-m-d H:i:s" }}
-
Sistem Informasi Manajemen Surat & Buku Induk Siswa Digital Terintegrasi
Total Surat
+Surat Masuk
+Surat Keluar
+Total Siswa
+| No. Surat | +Perihal | +Tipe | +Tanggal | +Aksi | +
|---|---|---|---|---|
| {{ letter.letter_number }} | +{{ letter.subject }} | ++ + {{ letter.get_type_display }} + + | +{{ letter.date|date:"d M Y" }} | ++ Detail + | +
| Belum ada data surat. | +||||