Commit 96d12d8c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg

Add code for the homepage

parent f2dd7e4e
......@@ -4,6 +4,7 @@ from django.db import models
from django.db.models import Q
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _, string_concat
from django.urls import reverse
from utils.translation import MultilingualField, ModelTranslateMeta
......@@ -136,7 +137,7 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
raise ValidationError(errors)
def get_absolute_url(self):
return ''
return reverse('events:event', args=[str(self.pk)])
def __str__(self):
return '{}: {}'.format(
......
<div class="blog">
<ul class="row">
{% for event in events %}
<li class="post span6 has-overlay event">
<a href="{{ event.get_absolute_url }}">
<div class="post-inner">
<div class="post-body"><h2>{{ event.title }}</h2>
<div class="post-date circle">
<div class="circle-border"></div>
<div class="circle-inner">{{ event.start.day }}<span>{{ event.start|date:"M" }}</span></div>
</div>
<div class="post-excerpt">
<p>{{ event.description }}</p>
</div>
</div>
</div>
</a>
</li>
{% endfor %}
</ul>
</div>
\ No newline at end of file
from django import template
from django.utils import timezone
from events.models import Event
register = template.Library()
@register.inclusion_tag('events/cards.html')
def show_cards():
upcoming_events = Event.objects.filter(
published=True,
end__gte=timezone.now()
).order_by('end')
return {'events': upcoming_events[:4]}
{% extends 'base.html' %}
{% block title %}Thaliawebsite{% endblock %}
{% load i18n event_cards %}
{% block body %}
<h1>Hello world</h1>
<h1>{% trans "Thalia, the study association of Computer Science and Information Science" %}</h1>
<p>Dit is een statische placeholder. Dit werkt op dit moment:
<ul>
<li><a href="/admin/">Ga naar de admin</a></li>
<li><a href="/members/">Zie een voorbeeld met de ledenlijst</a></li>
</ul>
<p class="text-center">
{% blocktrans %}Thalia is the study association for the Computer Science and Information Science students at Radboud University in Nijmegen. Thalia provides you the necessary distractions during your studies, as we've been doing for the past 25 years. And via Thalia students can easily connect with teachers and students from other years.{% endblocktrans %}
</p>
<h1>{% trans "Upcoming events" %}</h1>
{% show_cards %}
<p class="text-center">{% trans "Searching for another event?" %} <a href="{% url "events:index" %}">{% trans "Take a look at the entire agenda" %}</a>. </p>
{% 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