Commit 34729f85 authored by Rau Layug's avatar Rau Layug

Merged layug/calendar

parents 0ad58dbd ad9ba74c
......@@ -2,14 +2,17 @@ from django.contrib import admin
from .models import Event, Location
# Register your models here.
class LocationAdmin(admin.ModelAdmin):
model = Location
list_display = ('mode', 'venue')
class EventAdmin(admin.ModelAdmin):
model = Event
list_display = ('target_date', 'activity', 'estimated_hours', 'location')
list_display = ('target_date', 'activity', 'estimated_hours', 'course', 'location')
admin.site.register(Location, LocationAdmin)
admin.site.register(Event, EventAdmin)
# Generated by Django 4.0.3 on 2022-05-15 09:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('assignments', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Location',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mode', models.CharField(choices=[('ONS', 'Onsite'), ('ONL', 'Online'), ('OAO', 'Onsite and Online')], max_length=18)),
('venue', models.CharField(max_length=150)),
],
),
migrations.CreateModel(
name='Event',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('target_date', models.DateField()),
('activity', models.CharField(max_length=150)),
('estimated_hours', models.FloatField()),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='assignments.course')),
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='calendarapp.location')),
],
),
]
......@@ -10,7 +10,7 @@ class Location(models.Model):
("ONL", "Online"),
("OAO", "Onsite and Online")
]
mode = models.CharField(max_length=18, choices=MODE_CHOICES)
mode = models.CharField(max_length=3, choices=MODE_CHOICES)
venue = models.CharField(max_length=150)
image = models.ImageField(upload_to='widget_group_25/widget_group_25/static/calendarapp/img', height_field=None, width_field=None, max_length=100)
......
......@@ -12,3 +12,4 @@ def calendar(request):
def events(request, id):
return render(request, 'calendarapp/events.html', {'event': Event.objects.get(id=id)})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment