Create 'become a member' page

This includes restructuring misc document templates
and properly slugifying document names
parent 783e11fa
<li class="post span3 has-overlay">
<div class="post-inner">
<div class="post-header">
<a href="portfolio-single-wide.html">
<!-- TODO create a more meaningful thumbnail -->
<img src="https://placehold.it/200x200" />
</a>
</div>
<div class="post-body">
<h2><a href="portfolio-single-wide.html">{{ document.name }}</a></h2>
</div>
<div class="post-overlay">
<div class="post-overlay-meta">
<h2>{{ document.name }}</h2>
</div>
<ul class="post-overlay-icons">
<li>
<span></span><a href="{% block "downloadlink" %}{% endblock %}" class="overlay-icon-link" target="_blank"></a>
</li>
</ul>
</div>
</div>
</li>
\ No newline at end of file
<li class="post span3 has-overlay">
<div class="post-inner">
<div class="post-header">
<a href="portfolio-single-wide.html">
<!-- TODO create a more meaningful thumbnail -->
<img src="https://placehold.it/200x200" />
</a>
</div>
<div class="post-body">
<h2><a href="portfolio-single-wide.html">{{ document.name }}</a></h2>
</div>
<div class="post-overlay">
<div class="post-overlay-meta">
<h2>{{ document.name }}</h2>
</div>
<ul class="post-overlay-icons">
<li>
<span></span><a href="{% url 'documents:miscellaneous-document' document.pk %}" class="overlay-icon-link" target="_blank"></a>
</li>
</ul>
</div>
</div>
</li>
\ No newline at end of file
{% extends 'documents/generic.html' %}
{% block "downloadlink" %}{% url 'documents:miscellaneous-document' document.pk %}{% endblock %}
......@@ -2,6 +2,7 @@ from django.shortcuts import get_object_or_404, render
from django.utils import timezone
from django.core.exceptions import PermissionDenied
from django.contrib.auth.decorators import login_required
from django.utils.text import slugify
from documents.models import AssociationDocumentsYear, MiscellaneousDocument
from documents.models import GeneralMeeting, GeneralMeetingDocument
......@@ -43,11 +44,13 @@ def index(request):
def get_miscellaneous_document(request, pk):
document = get_object_or_404(MiscellaneousDocument, pk=int(pk))
_, ext = os.path.splitext(document.file.path)
# TODO verify if we need to check a permission instead.
# This depends on how we're dealing with ex-members.
if document.members_only and not request.user.is_authenticated():
raise PermissionDenied
return sendfile(request, document.file.path, attachment=True)
return sendfile(request, document.file.path, attachment=True,
attachment_filename=slugify(document.name) + ext)
# TODO verify if we need to check a permission instead.
......
......@@ -23,6 +23,7 @@ class UserAdmin(BaseUserAdmin):
# FIXME use nicer form
# form = forms.AdminForm (base on ModelForm, reorder elements, etc).
admin.site.register(models.BecomeAMemberDocument)
# re-register User admin
admin.site.unregister(User)
......
# -*- coding: utf-8 -*-
# Generated by Django 1.10b1 on 2016-07-27 18:40
from __future__ import unicode_literals
from django.db import migrations, models
import utils.validators
class Migration(migrations.Migration):
dependencies = [
('members', '0001_squashed_0002_auto_20160707_1512'),
]
operations = [
migrations.CreateModel(
name='BecomeAMemberDocument',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('file', models.FileField(upload_to='members/', validators=[utils.validators.validate_file_extension])),
],
),
]
from django.utils import timezone
from django.db import models
from django.core import validators
from django.conf import settings
......@@ -8,6 +7,8 @@ from django.utils.translation import ugettext_lazy as _
from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES
from localflavor.generic.models import IBANField
from utils.validators import validate_file_extension
class Member(models.Model):
"""This class describes a member"""
......@@ -242,3 +243,14 @@ class Member(models.Model):
def __str__(self):
return self.display_name()
class BecomeAMemberDocument(models.Model):
name = models.CharField(max_length=200)
file = models.FileField(
upload_to='members/',
validators=[validate_file_extension],
)
def __str__(self):
return self.name
{% extends 'documents/generic.html' %}
{% block "downloadlink" %}{% url 'members:become-a-member-document' document.pk %}{% endblock %}
......@@ -4,5 +4,6 @@ from . import views
urlpatterns = [
url('^become-a-member-document/(?P<pk>[0-9]*)', views.get_become_a_member_document, name='become-a-member-document'),
url('^', views.index),
]
from django.shortcuts import render
from django.shortcuts import get_object_or_404, render
from django.utils.text import slugify
from . import models
import os
from sendfile import sendfile
def index(request):
members = models.Member.objects.all()
return render(request, 'members/index.html', {'members': members})
def become_a_member(request):
context = {'documents': models.BecomeAMemberDocument.objects.all()}
return render(request, 'singlepages/become_a_member.html', context)
def get_become_a_member_document(request, pk):
document = get_object_or_404(models.BecomeAMemberDocument, pk=int(pk))
_, ext = os.path.splitext(document.file.path)
return sendfile(request, document.file.path, attachment=True,
attachment_filename=slugify(document.name) + ext)
This diff was suppressed by a .gitattributes entry.
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-27 21:40+0200\n"
"PO-Revision-Date: 2016-07-27 21:42+0100\n"
"Last-Translator: Joost Rijneveld <joost@joostrijneveld.nl>\n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.10\n"
#: admin.py:5
msgid "Thalia administration"
msgstr ""
#: admin.py:6
msgid "Thalia"
msgstr ""
#: menus.py:4
msgid "Home"
msgstr ""
#: menus.py:5
msgid "Association"
msgstr ""
#: menus.py:6
msgid "Board"
msgstr ""
#: menus.py:7
msgid "Committees"
msgstr ""
#: menus.py:8 menus.py:10
msgid "Members"
msgstr ""
#: menus.py:9
msgid "Documents"
msgstr ""
#: menus.py:11
msgid "Sister Associations"
msgstr ""
#: menus.py:12
msgid "Become Member"
msgstr ""
#: menus.py:13
msgid "Thabloid"
msgstr ""
#: menus.py:15
msgid "For Members"
msgstr ""
#: menus.py:16
msgid "Photos"
msgstr ""
#: menus.py:17
msgid "Statistics"
msgstr ""
#: menus.py:18
msgid "Become Active"
msgstr ""
#: menus.py:19
msgid "Wiki"
msgstr ""
#: menus.py:21
msgid "Calendar"
msgstr ""
#: menus.py:22
msgid "Career"
msgstr ""
#: menus.py:23
msgid "Sponsor"
msgstr ""
#: menus.py:24
msgid "Vacancies"
msgstr ""
#: menus.py:26
msgid "Education"
msgstr ""
#: menus.py:27
msgid "Book Sale"
msgstr ""
#: menus.py:28
msgid "Course Overview"
msgstr ""
#: menus.py:29
msgid "Add Exam"
msgstr ""
#: menus.py:30
msgid "Add Summary"
msgstr ""
#: menus.py:32
msgid "Contact"
msgstr ""
#: settings/settings.py:137
msgid "English"
msgstr ""
#: settings/settings.py:138
msgid "Dutch"
msgstr ""
#: templates/base.html:84 templates/base.html:121
msgid "Study Association Thalia"
msgstr ""
#: templates/base.html:142 templates/registration/login.html:3
#: templates/registration/login.html:24
msgid "Login"
msgstr ""
#: templates/registration/login.html:8
msgid ""
"\n"
" <p>Your account does not have access to this page. To proceed, "
"please\n"
" log in with an account that has access.</p>\n"
" "
msgstr ""
#: templates/registration/login.html:13
msgid ""
"\n"
" <p>Please log in to see this page.</p>\n"
" "
msgstr ""
#: templates/singlepages/become_a_member.html:4
#: templates/singlepages/become_a_member.html:7
msgid "Become a Member"
msgstr "Lid Worden\t"
#: templates/singlepages/become_a_member.html:9
msgid ""
"Thalia is the study association for Computing Science and Information "
"Sciences students at the Radboud University in Nijmegen. Thalia organises a "
"wide variety of activities, such as bowling events, go cart racing, lunch "
"lectures, drinks and much more! Furthermore, members get access to our tests "
"and summaries database, as well as discounts on books. There's no reason not "
"to become a member!"
msgstr ""
"Thalia is de studievereniging voor Informatica en Informatiekunde studenten "
"van de Radboud Universiteit te Nijmegen. Thalia organiseert diverse "
"activiteiten, zoals bowlen, karten, lunchlezingen, borrels en nog veel meer! "
"Verder krijg je als lid toegang tot onze tentamen- en samenvattingendatabase "
"en kun je met korting je studieboeken bestellen. Kortom, geen reden om niet "
"lid te worden!"
#: templates/singlepages/become_a_member.html:11
msgid "How do I become a member?"
msgstr "Hoe kan ik lid worden?"
#: templates/singlepages/become_a_member.html:13
msgid ""
"You can become a member of Thalia at any time during the year. Membership "
"costs € 7.50 per year, or € 30 for your entire study duration. To become a "
"member, please fill out the membership form. You can get the form at the "
"board room (HG00.150, above the north kanteen in the Huygens building), or "
"download it below. After signing the form, return it to the board room. "
"Note: Only Computing Science and Information Sciences students at the "
"Radboud University can become a member."
msgstr ""
"Je kunt op elk moment van het collegejaar lid worden van Thalia. Een "
"lidmaatschap kost € 7,50 per jaar, of € 30 voor je hele studieperiode. Om "
"lid te worden dien je het lidmaatschapsformulier in te vullen. Dit formulier "
"kun je bij de bestuurskamer (HG00.150, boven de Noordkantine van het "
"Huygensgebouw) ophalen of downloaden via de website en ondertekend inleveren "
"bij bestuurskamer Let wel op: Je kunt alleen lid worden wanneer je "
"informatica of informatiekunde studeert aan de Radboud Universiteit."
#: templates/singlepages/become_a_member.html:15
msgid ""
"I'm not a Computing Science and Information Sciences student at the Radboud "
"University, but I do want to attend your events. Now what?"
msgstr ""
"Ik studeer geen Informatica of Informatiekunde (aan de Radboud "
"Universiteit), maar ik wil wel naar jullie activiteiten gaan. Wat nu?"
#: templates/singlepages/become_a_member.html:17
msgid ""
"It is still possible to be associated with Thalia, even if you do not study "
"Computing Science or Information Sciences (anymore): You can become a "
"supporter. For at least € 7.50 per year, you too can enjoy everything Thalia "
"has to offer. If you are not a former Thalia member, ICIS staff member or "
"alumni, you must submit a written along with two signatures of current "
"Thalia members. You can fill all of this in on the supporter form, which you "
"can get at the board room (HG00.150, above the north kanteen in the Huygens "
"building), or download below."
msgstr ""
"Mocht je nu geen Informatica of Informatiekunde (meer) studeren, maar toch "
"verbonden willen zijn, dan kan dat ook. Hiervoor kun je begunstiger van "
"Thalia worden. Voor minimaal € 7,50 per jaar kun je ook genieten van alles "
"wat Thalia je te bieden heeft. Ben je geen oud-Thaliaan, ex-Informaticus of -"
"Informatiekundige, dan dien je twee handtekeningen van leden van Thalia "
"samen met een motivatie waarom je begunstiger wil worden af te geven. Dit "
"kun je allemaal invullen op het begunstigerformulier, dat af te halen is in "
"de bestuurskamer of hieronder te downloaden is."
#: templates/singlepages/become_a_member.html:19
msgid ""
"Payment for membership or sponsorship can be made both in cash or by "
"authorised direct debit. To authorise direct debit, use the form that is "
"also available below. If you have any other questions about Thalia and/or "
"your membership, feel free to email <a href=\"mailto:info@thalia.nu\" target="
"\"_blank\">info@thalia.nu</a>!"
msgstr ""
"Betalen voor je lidmaatschap / begunstigerschap kan zowel contant als met "
"een machtiging. Voor machtigingen gebruiken we een machtigingsformulier, dat "
"hieronder te downloaden is. Mocht je nog verdere vragen hebben over Thalia "
"en/of je lidmaatschap dan kun je altijd mailen naar <a href=\"mailto:"
"info@thalia.nu\" target=\"_blank\">info@thalia.nu</a>!"
......@@ -9,7 +9,7 @@ main = [
{'title': _('Documents'), 'name': 'documents:index'},
{'title': _('Members'), 'name': '#'},
{'title': _('Sister Associations'), 'name': '#'},
{'title': _('Become Member'), 'name': '#'},
{'title': _('Become Member'), 'name': 'become-a-member'},
{'title': _('Thabloid'), 'name': '#'},
]},
{'title': _('For Members'), 'name': '#', 'submenu': [
......
{% extends "base.html" %}
{% load i18n %}
{% block page_title %}{% trans "Become a Member" %}{% endblock %}
{% block body %}
<h1>{% trans "Become a Member" %}</h1>
<p>{% trans "Thalia is the study association for Computing Science and Information Sciences students at the Radboud University in Nijmegen. Thalia organises a wide variety of activities, such as bowling events, go cart racing, lunch lectures, drinks and much more! Furthermore, members get access to our tests and summaries database, as well as discounts on books. There's no reason not to become a member!" %}</p>
<h4>{% trans "How do I become a member?" %}</h4>
<p>{% trans "You can become a member of Thalia at any time during the year. Membership costs € 7.50 per year, or € 30 for your entire study duration. To become a member, please fill out the membership form. You can get the form at the board room (HG00.150, above the north kanteen in the Huygens building), or download it below. After signing the form, return it to the board room. Note: Only Computing Science and Information Sciences students at the Radboud University can become a member." %}</p>
<h4>{% trans "I'm not a Computing Science and Information Sciences student at the Radboud University, but I do want to attend your events. Now what?" %}</h4>
<p>{% trans "It is still possible to be associated with Thalia, even if you do not study Computing Science or Information Sciences (anymore): You can become a supporter. For at least € 7.50 per year, you too can enjoy everything Thalia has to offer. If you are not a former Thalia member, ICIS staff member or alumni, you must submit a written along with two signatures of current Thalia members. You can fill all of this in on the supporter form, which you can get at the board room (HG00.150, above the north kanteen in the Huygens building), or download below." %}</p>
<p>{% blocktrans %}Payment for membership or sponsorship can be made both in cash or by authorised direct debit. To authorise direct debit, use the form that is also available below. If you have any other questions about Thalia and/or your membership, feel free to email <a href="mailto:info@thalia.nu" target="_blank">info@thalia.nu</a>!{% endblocktrans %}</p>
<div class="portfolio">
<ul class="portfolio-posts row" style="padding-top:20px;">
{% for document in documents %}
{% include 'members/become_a_member_document.html' with document=document %}
{% endfor %}
</ul>
</div>
{% endblock %}
......@@ -17,13 +17,16 @@ from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
import members
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='index.html'), name='index'),
url(r'^admin/', admin.site.urls),
url(r'^members/', include('members.urls')),
url(r'^members/', include('members.urls', namespace='members')),
url(r'^nyi$', TemplateView.as_view(template_name='status/nyi.html'), name='#'),
url(r'^association/', include([
url(r'^documents/', include('documents.urls', namespace='documents')),
url(r'^become-a-member/', members.views.become_a_member, name='become-a-member'),
])),
# Default login helpers
url(r'^', include('django.contrib.auth.urls')),
......
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