Updated templates to match project specifications

parent b9f2ee58
...@@ -19,14 +19,19 @@ class Location(models.Model): ...@@ -19,14 +19,19 @@ class Location(models.Model):
class Event(models.Model): class Event(models.Model):
target_datetime = models.DateTimeField()
activity = models.CharField(max_length=100) activity = models.CharField(max_length=100)
target_datetime = models.DateTimeField()
estimated_hours = models.FloatField() estimated_hours = models.FloatField()
location = models.ForeignKey( location = models.ForeignKey(
Location, Location,
on_delete=models.CASCADE on_delete=models.CASCADE
) )
course = models.ForeignKey(Course, related_name='event', on_delete=models.CASCADE, null=True) course = models.ForeignKey(
Course,
related_name='event',
on_delete=models.CASCADE,
null=True
)
def __str__(self): def __str__(self):
return '{} on {}'.format(self.activity, self.target_datetime) return '{} on {}'.format(self.activity, self.target_datetime)
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<h1>Add Event</h1> <title>Add Activity</title>
Add a new activity:
<form method="post"> <form method="post">
...@@ -12,7 +14,7 @@ ...@@ -12,7 +14,7 @@
<a href="/Events/{{Event.pk}}/details"> <a href="/Events/{{Event.pk}}/details">
<button type="submit">Add Event</button> <button type="submit">Save New Activity</button>
</a> </a>
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<title>Event</title> <title>{{object.activity}}</title>
<br><br>
<h2>{{object.activity}}</h2> <h2>{{object.activity}}</h2>
<h3>Date and Time: {{object.target_datetime}}</h3> <br>Date and Time: {{object.target_datetime|date:"m/d/y, h:i A"}}<br>
<h3>Estimated Hours: {{object.estimated_hours}}</h3> <br>Estimated Hours: {{object.estimated_hours}}<br>
<h3>{{course}}</h3> <br>{{object.course.code}} {{object.course.title}} - {{object.course.section}}<br>
<h3>Mode: {{location.mode}}</h3> <br>Mode: {{object.location.mode}}<br>
<h3>Venue: {{location.venue}}</h3> <br>Venue: {{object.location.venue}}<br>
<br><br>
<a href="edit"> <a href="edit">
<input type="button" value="Edit Event"> <input type="button" value="Edit Activity">
</a>" </a>
{% endblock content %} {% endblock content %}
\ No newline at end of file
...@@ -3,13 +3,16 @@ ...@@ -3,13 +3,16 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<h1>Edit Event</h1>
<title>Edit Activity</title>
Edit Activity:<br>
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Edit Event" /> <input type="submit" value="Save New Activity" />
</a> </a>
</form> </form>
{% endblock content %} {% endblock content %}
\ No newline at end of file
...@@ -6,7 +6,10 @@ from django.urls import reverse ...@@ -6,7 +6,10 @@ from django.urls import reverse
def index(request): def index(request):
html_string = 'robo_mommy’s Calendar of Activities<br><ul>' html_string = '''
<title>robo_mommy’s Calendar of Activities</title>
<h2>robo_mommy’s Calendar of Activities</h2><ul>
'''
for eventItem in Event.objects.all(): for eventItem in Event.objects.all():
eventId = str(eventItem.pk) eventId = str(eventItem.pk)
href = '<a href="widget_Calendar/Events/'+eventId+'/details">' href = '<a href="widget_Calendar/Events/'+eventId+'/details">'
......
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