Add plain index page, example view for members

parent 3e03b1f1
......@@ -237,5 +237,8 @@ class Member(models.Model):
return "'{}' {}".format(self.nickname,
self.user.last_name)
else:
return self.user.full_name()
return self.user.get_full_name()
display_name.short_description = _('Display name')
def __str__(self):
return self.display_name()
......@@ -3,5 +3,14 @@
{% block title %}Hello World{% endblock %}
{% block body %}
Hello world
<h1>Hello world</h1>
<p>These are the current members:
<ul>
{% for member in members %}
<li>{{ member }} - {{ member.type }}</li>
{% endfor %}
</ul>
</p>
{% endblock %}
from django.shortcuts import render
from . import models
def index(request):
return render(request, 'members/index.html')
members = models.Member.objects.all()
return render(request, 'members/index.html', {'members': members})
{% extends 'base.html' %}
{% block title %}Thaliawebsite{% endblock %}
{% block body %}
<h1>Hello world</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>
{% endblock %}
......@@ -15,9 +15,10 @@ Including another URLconf
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html')),
url(r'^admin/', admin.site.urls),
url(r'^members/', include('members.urls')),
# Default login helpers
......
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