Commit dfc29402 authored by Ciella Francisco's avatar Ciella Francisco 😵

Modified html templates and models to enable URL redirectin for adding and editing events

parent ab78e69f
...@@ -22,6 +22,9 @@ class Event(models.Model): ...@@ -22,6 +22,9 @@ class Event(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse('event_management:event-details', kwargs={'pk': self.pk}) return reverse('event_management:event-details', kwargs={'pk': self.pk})
def get_update_url(self):
return reverse('event_management:event-update', kwargs={'pk': self.pk})
# def save(self, *args, **kwargs): # def save(self, *args, **kwargs):
# if self.event_datetime_end is None: # if self.event_datetime_end is None:
# self.event_datetime_end = self.event_datetime_start + timedelta(hours=1) # self.event_datetime_end = self.event_datetime_start + timedelta(hours=1)
......
...@@ -12,4 +12,5 @@ ...@@ -12,4 +12,5 @@
{% for promo in object.promos.all %} {% for promo in object.promos.all %}
<img src="{{ promo.img.url }}"/> <img src="{{ promo.img.url }}"/>
{% endfor %} {% endfor %}
<button type="button" onclick="location.href='{{ event.get_update_url }}'">Update</button>
{% endblock %} {% endblock %}
...@@ -13,4 +13,5 @@ ...@@ -13,4 +13,5 @@
</ul> </ul>
{% endfor %} {% endfor %}
</ul> </ul>
<button type="button" onclick="location.href='/events/add/'">Add Event</button>
{% endblock %} {% endblock %}
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