diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..50e79a4 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..6cd0a0e 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 e061640..64f448d 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2a36fd6..02d6866 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..ade1440 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,19 @@ from django.contrib import admin +from .models import Program, SongRequest -# Register your models here. +@admin.register(Program) +class ProgramAdmin(admin.ModelAdmin): + list_display = ('title', 'day', 'start_time', 'end_time', 'dj_name') + list_filter = ('day',) + search_fields = ('title', 'dj_name') + +@admin.register(SongRequest) +class SongRequestAdmin(admin.ModelAdmin): + list_display = ('song_title', 'artist_name', 'listener_name', 'created_at', 'is_played') + list_filter = ('is_played', 'created_at') + search_fields = ('song_title', 'artist_name', 'listener_name') + actions = ['mark_as_played'] + + def mark_as_played(self, request, queryset): + queryset.update(is_played=True) + mark_as_played.short_description = "Mark selected requests as played" \ No newline at end of file diff --git a/core/forms.py b/core/forms.py new file mode 100644 index 0000000..f31cdcc --- /dev/null +++ b/core/forms.py @@ -0,0 +1,13 @@ +from django import forms +from .models import SongRequest + +class SongRequestForm(forms.ModelForm): + class Meta: + model = SongRequest + fields = ['listener_name', 'song_title', 'artist_name', 'message'] + widgets = { + 'listener_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Your Name'}), + 'song_title': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Song Title'}), + 'artist_name': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Artist Name'}), + 'message': forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Optional message', 'rows': 3}), + } diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..9f2bd34 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,41 @@ +# Generated by Django 5.2.7 on 2026-02-03 21:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Program', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('description', models.TextField(blank=True)), + ('day', models.CharField(choices=[('MON', 'Monday'), ('TUE', 'Tuesday'), ('WED', 'Wednesday'), ('THU', 'Thursday'), ('FRI', 'Friday'), ('SAT', 'Saturday'), ('SUN', 'Sunday')], max_length=3)), + ('start_time', models.TimeField()), + ('end_time', models.TimeField()), + ('dj_name', models.CharField(blank=True, max_length=100)), + ], + options={ + 'ordering': ['day', 'start_time'], + }, + ), + migrations.CreateModel( + name='SongRequest', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('listener_name', models.CharField(max_length=100)), + ('song_title', models.CharField(max_length=200)), + ('artist_name', models.CharField(max_length=200)), + ('message', models.TextField(blank=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('is_played', models.BooleanField(default=False)), + ], + ), + ] 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..fc7748a 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..a1cb243 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,35 @@ from django.db import models -# Create your models here. +class Program(models.Model): + DAYS_OF_WEEK = [ + ('MON', 'Monday'), + ('TUE', 'Tuesday'), + ('WED', 'Wednesday'), + ('THU', 'Thursday'), + ('FRI', 'Friday'), + ('SAT', 'Saturday'), + ('SUN', 'Sunday'), + ] + title = models.CharField(max_length=200) + description = models.TextField(blank=True) + day = models.CharField(max_length=3, choices=DAYS_OF_WEEK) + start_time = models.TimeField() + end_time = models.TimeField() + dj_name = models.CharField(max_length=100, blank=True) + + class Meta: + ordering = ['day', 'start_time'] + + def __str__(self): + return f"{self.title} ({self.get_day_display()})" + +class SongRequest(models.Model): + listener_name = models.CharField(max_length=100) + song_title = models.CharField(max_length=200) + artist_name = models.CharField(max_length=200) + message = models.TextField(blank=True) + created_at = models.DateTimeField(auto_now_add=True) + is_played = models.BooleanField(default=False) + + def __str__(self): + return f"{self.song_title} by {self.artist_name} - Requested by {self.listener_name}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..ec98fd9 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,70 @@ -
- -