diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..e3f99b3 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..307821c 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..a4ac441 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..aec4316 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,14 @@ from django.contrib import admin +from .models import Hospital, DepartmentChief -# Register your models here. +@admin.register(Hospital) +class HospitalAdmin(admin.ModelAdmin): + list_display = ('name', 'state', 'city') + list_filter = ('state',) + search_fields = ('name', 'city') + +@admin.register(DepartmentChief) +class DepartmentChiefAdmin(admin.ModelAdmin): + list_display = ('name', 'department', 'hospital', 'email') + list_filter = ('department', 'hospital__state') + search_fields = ('name', 'email', 'hospital__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..8df85e4 --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,40 @@ +# Generated by Django 5.2.7 on 2026-01-28 14:27 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Hospital', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('state', models.CharField(choices=[('BW', 'Baden-Württemberg'), ('BY', 'Bayern'), ('BE', 'Berlin'), ('BB', 'Brandenburg'), ('HB', 'Bremen'), ('HH', 'Hamburg'), ('HE', 'Hessen'), ('MV', 'Mecklenburg-Vorpommern'), ('NI', 'Niedersachsen'), ('NW', 'Nordrhein-Westfalen'), ('RP', 'Rheinland-Pfalz'), ('SL', 'Saarland'), ('SN', 'Sachsen'), ('ST', 'Sachsen-Anhalt'), ('SH', 'Schleswig-Holstein'), ('TH', 'Thüringen')], max_length=2)), + ('city', models.CharField(max_length=100)), + ('address', models.TextField(blank=True)), + ('website', models.URLField(blank=True)), + ], + options={ + 'verbose_name_plural': 'Hospitals', + }, + ), + migrations.CreateModel( + name='DepartmentChief', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('title', models.CharField(help_text='e.g. Chief of Medicine, Head Nurse', max_length=100)), + ('department', models.CharField(choices=[('AN', 'Anesthesia'), ('NU', 'Nursing'), ('IC', 'Intensive Care'), ('SU', 'Surgery'), ('IM', 'Internal Medicine'), ('PE', 'Pediatrics'), ('GY', 'Gynecology'), ('OT', 'Other')], max_length=2)), + ('email', models.EmailField(max_length=254)), + ('hospital', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chiefs', to='core.hospital')), + ], + ), + ] 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..597177c 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..1a527e6 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,54 @@ from django.db import models -# Create your models here. +class Hospital(models.Model): + STATES_CHOICES = [ + ('BW', 'Baden-Württemberg'), + ('BY', 'Bayern'), + ('BE', 'Berlin'), + ('BB', 'Brandenburg'), + ('HB', 'Bremen'), + ('HH', 'Hamburg'), + ('HE', 'Hessen'), + ('MV', 'Mecklenburg-Vorpommern'), + ('NI', 'Niedersachsen'), + ('NW', 'Nordrhein-Westfalen'), + ('RP', 'Rheinland-Pfalz'), + ('SL', 'Saarland'), + ('SN', 'Sachsen'), + ('ST', 'Sachsen-Anhalt'), + ('SH', 'Schleswig-Holstein'), + ('TH', 'Thüringen'), + ] + + name = models.CharField(max_length=255) + state = models.CharField(max_length=2, choices=STATES_CHOICES) + city = models.CharField(max_length=100) + address = models.TextField(blank=True) + website = models.URLField(blank=True) + + def __str__(self): + return f"{self.name} ({self.get_state_display()})" + + class Meta: + verbose_name_plural = "Hospitals" + +class DepartmentChief(models.Model): + DEPARTMENT_CHOICES = [ + ('AN', 'Anesthesia'), + ('NU', 'Nursing'), + ('IC', 'Intensive Care'), + ('SU', 'Surgery'), + ('IM', 'Internal Medicine'), + ('PE', 'Pediatrics'), + ('GY', 'Gynecology'), + ('OT', 'Other'), + ] + + hospital = models.ForeignKey(Hospital, on_delete=models.CASCADE, related_name='chiefs') + name = models.CharField(max_length=255) + title = models.CharField(max_length=100, help_text="e.g. Chief of Medicine, Head Nurse") + department = models.CharField(max_length=2, choices=DEPARTMENT_CHOICES) + email = models.EmailField() + + def __str__(self): + return f"{self.name} - {self.get_department_display()} at {self.hospital.name}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..cfb4490 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -3,23 +3,96 @@
-