Commit 312176d1 authored by Jose Gabriel L. Salas's avatar Jose Gabriel L. Salas

fixed views.py formatting

parent d913f342
...@@ -9,16 +9,16 @@ class EventAdmin(admin.ModelAdmin): ...@@ -9,16 +9,16 @@ class EventAdmin(admin.ModelAdmin):
list_display = ( list_display = (
'target_datetime', 'activity', 'estimated_hours', 'target_datetime', 'activity', 'estimated_hours',
'location', 'course', 'location', 'course',
) )
list_filter = ('target_datetime', 'course', ) list_filter = ('target_datetime', 'course', )
fieldsets = [ fieldsets = [
('Activity', { ('Activity', {
'fields': [ 'fields': [
('activity', 'course', ), ('activity', 'course', ),
'target_datetime', 'location', 'estimated_hours' 'target_datetime', 'location', 'estimated_hours'
] ]
}), }),
] ]
class LocationAdmin(admin.ModelAdmin): class LocationAdmin(admin.ModelAdmin):
......
...@@ -12,7 +12,7 @@ class Location(models.Model): ...@@ -12,7 +12,7 @@ class Location(models.Model):
] ]
mode = models.CharField( mode = models.CharField(
max_length=6, choices=mode_choices, default=onsite, max_length=6, choices=mode_choices, default=onsite,
) )
venue = models.CharField(max_length=100) venue = models.CharField(max_length=100)
def __str__(self): def __str__(self):
......
...@@ -4,21 +4,20 @@ from .models import Event, Location ...@@ -4,21 +4,20 @@ from .models import Event, Location
def index(request): def index(request):
return_string = "<p>Widget's Calendar of Activities</p> <ul style='list-style: none; padding: 0; margin: 0;'> " return_string = "<p>Widget's Calendar of Activities</p>"
for events in Event.objects.all(): for events in Event.objects.all():
round_hours = ("{:0.0f}".format(events.estimated_hours)) round_hours = ("{:0.0f}".format(events.estimated_hours))
return_string += '<li>Date and Time: {}<br>'.format( return_string += 'Date and Time: {}<br>'.format(
events.target_datetime.strftime('%m/%d/%Y, %H:%M %p') events.target_datetime.strftime('%m/%d/%Y, %H:%M %p')
) )
return_string += 'Activity: {}<br>'.format(events.activity) return_string += 'Activity: {}<br>'.format(events.activity)
return_string += 'Estimated Hours: {}<br>'.format(round_hours) return_string += 'Estimated Hours: {}<br>'.format(round_hours)
return_string += 'Course/Section: {}<br>'.format(events.course) return_string += 'Course/Section: {}<br>'.format(events.course)
return_string += 'Mode: {}<br>'.format(events.location.mode) return_string += 'Mode: {}<br>'.format(events.location.mode)
return_string += 'Venue: {}<br></li>'.format(events.location.venue) return_string += 'Venue: {}<br>'.format(events.location.venue)
return_string += '<br>' return_string += '<br>'
return_string += '</ul>'
html_string = '<html><body>{}</body></html>'.format(return_string) html_string = '<html><body>{}</body></html>'.format(return_string)
return HttpResponse(html_string) return HttpResponse(html_string)
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