Changed output in views of calendar

parent 58e4cee4
...@@ -9,14 +9,14 @@ class EventInline(admin.TabularInline): ...@@ -9,14 +9,14 @@ class EventInline(admin.TabularInline):
class EventAdmin(admin.ModelAdmin): class EventAdmin(admin.ModelAdmin):
model = Event model = Event
list_display = ('target_datetime', 'activity', 'estimated_hours', 'location') list_display = ('activity', 'target_datetime', 'estimated_hours', 'course', 'location')
search_fields = ('target_datetime', 'activity', 'estimated_hours', 'location') search_fields = ('activity', 'target_datetime', 'estimated_hours', 'course', 'location')
list_filter = ('target_datetime', 'location') list_filter = ('activity', 'location')
fieldsets = [ fieldsets = [
('Event', { ('Event', {
'fields': 'fields':
(('target_datetime', 'activity'), 'estimated_hours', 'location',), (('target_datetime', 'activity'), 'estimated_hours', 'course', 'location',),
}), }),
] ]
...@@ -36,8 +36,6 @@ class LocationAdmin(admin.ModelAdmin): ...@@ -36,8 +36,6 @@ class LocationAdmin(admin.ModelAdmin):
] ]
inlines = [EventInline, ]
admin.site.register(Event, EventAdmin) admin.site.register(Event, EventAdmin)
admin.site.register(Location, LocationAdmin) admin.site.register(Location, LocationAdmin)
# Generated by Django 3.2 on 2023-03-06 02:13 # Generated by Django 3.2 on 2023-03-06 03:22
import datetime import datetime
from django.db import migrations, models from django.db import migrations, models
...@@ -25,11 +25,11 @@ class Migration(migrations.Migration): ...@@ -25,11 +25,11 @@ class Migration(migrations.Migration):
name='Event', name='Event',
fields=[ fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('target_datetime', models.DateTimeField(default=datetime.datetime(2023, 3, 6, 10, 13, 38, 850474))), ('target_datetime', models.DateTimeField(default=datetime.datetime(2023, 3, 6, 11, 22, 4, 870125))),
('activity', models.CharField(default='', max_length=100)), ('activity', models.CharField(default='', max_length=100)),
('estimated_hours', models.FloatField(default=0)), ('estimated_hours', models.FloatField(default=0)),
('course', models.CharField(default='', max_length=100)), ('course', models.CharField(default='', max_length=100)),
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Venue', to='calendar.location')), ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Venue', to='widget_calendar.location')),
], ],
), ),
] ]
# Generated by Django 3.2 on 2023-03-06 02:13 # Generated by Django 3.2 on 2023-03-06 03:22
import datetime import datetime
from django.db import migrations, models from django.db import migrations, models
...@@ -7,13 +7,13 @@ from django.db import migrations, models ...@@ -7,13 +7,13 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('calendar', '0001_initial'), ('widget_calendar', '0001_initial'),
] ]
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name='event', model_name='event',
name='target_datetime', name='target_datetime',
field=models.DateTimeField(default=datetime.datetime(2023, 3, 6, 10, 13, 56, 192323)), field=models.DateTimeField(default=datetime.datetime(2023, 3, 6, 11, 22, 12, 776680)),
), ),
] ]
...@@ -16,12 +16,14 @@ def index(request): ...@@ -16,12 +16,14 @@ def index(request):
for event in Event.objects.all(): for event in Event.objects.all():
location = event.location location = event.location
datetime = str(event.target_datetime)
estimated_hours = str(event.estimated_hours)
body += "<p style='border: 2px solid gray;\ body += "<p style='border: 2px solid gray;\
border-radius:5px;\ border-radius:5px;\
padding:20px 30px;'>\ padding:20px 30px;'>\
<b> Date and Time: "+event.target_datetime+" </b> <br>\ Date and Time: "+datetime+" <br>\
Activity: "+event.activity+" <br>\ Activity: "+event.activity+" <br>\
Estimated Hours: "+event.estimated_hours+" <br>\ Estimated Hours: "+estimated_hours+" <br>\
Course/Section: "+event.course+" <br>\ Course/Section: "+event.course+" <br>\
Mode: "+location.mode+" <br>\ Mode: "+location.mode+" <br>\
Venue: "+location.venue+" <br>\ Venue: "+location.venue+" <br>\
......
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