Forgot to stage files :0

This commit is contained in:
Jan Tuomi
2017-05-13 10:43:23 +03:00
parent fa13842e5f
commit b798f62a6b
10 changed files with 297 additions and 196 deletions
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-05-13 07:29
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0004_auto_20170512_1454'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='paid',
),
migrations.AlterField(
model_name='payment',
name='date',
field=models.DateTimeField(default=datetime.datetime(2017, 5, 13, 10, 29, 50, 116064)),
),
migrations.AlterField(
model_name='payment',
name='source',
field=models.CharField(choices=[('AYY', 'AYY'), ('cash', 'Cash'), ('bank_transfer', 'Bank transfer')], max_length=255),
),
]
+4 -3
View File
@@ -4,10 +4,11 @@
{% block content %}
<div>
<h3 class="inline-title">{% trans "Member applications" %}</h3>
</div>
<div>
<h2>{% trans "Member applications" %}</h2>
</div>
<div>
{{ table|safe }}
</div>
{% endblock content %}
+18
View File
@@ -0,0 +1,18 @@
{% extends "members_base.html" %}
{% load static %}
{% load i18n %}
{% block content %}
<div>
<div>
<h3>{% trans "Error" %}</h3>
</div>
<div class="alert alert-danger">
{{ error }}
</div>
<div>
<button onclick="window.history.back();" class="btn btn-primary">{% trans "Back" %}</button>
</div>
</div>
{% endblock content %}
+4 -2
View File
@@ -8,12 +8,14 @@
<div>
<div>
<h3 class="inline-title">{% trans "Member register" %}</h3>
<a id="download-csv" class="btn btn-info">{% trans "Download CSV" %}</a>
<h2>{% trans "Member register" %}</h2>
</div>
{{ table|safe }}
<div>
<a id="download-csv" class="btn btn-info">{% trans "Download CSV" %}</a>
</div>
<form action="/members/list" method="POST" id="collapse-filters" class="collapse filter-form">
<div class="filter-row">
+5 -2
View File
@@ -5,12 +5,15 @@
{% block content %}
<div>
<div>
<h3 class="inline-title">{% trans "Payment events" %}</h3>
<a id="download-csv" class="btn btn-info">{% trans "Download CSV" %}</a>
<h2>{% trans "Payment events" %}</h2>
</div>
{{ table|safe }}
<div>
<a id="download-csv" class="btn btn-info">{% trans "Download CSV" %}</a>
</div>
<form action="/members/list" method="POST" id="collapse-filters" class="collapse filter-form">
<div class="filter-row">
<div class="filter-group">
+15 -4
View File
@@ -53,6 +53,19 @@ def send_mail_wrapper(subject, message):
def convert_table_to_html(table, request):
'''
This is a horrible hack for converting a table object to raw html.
Even with extensive research I wasn't able to find a way to add a path
prefix "e.g. /members/list" to the query strings "e.g. ?sort=foo", so I
did it manually with string.replace.
Note: When adding the html to a page, you need to run it through
the "safe" filter. E.g. "{{ table|safe }}"
:param table: Table object from members.tables
:param request: HttpRequest
:return: Raw html string
'''
table_as_html = table.as_html(request)
path = request.path
@@ -118,8 +131,7 @@ def member_submit(request, *args, **kwargs):
memberlogger.info("Saved new member to member register with the following info: {}".format(form))
return HttpResponseRedirect('/members')
else:
print(form.errors)
return HttpResponse('oh shit')
return render(request, 'error.html', {'error': form.errors})
@ensure_csrf_cookie
@@ -254,8 +266,7 @@ def payment_submit(request, *args, **kwargs):
memberlogger.info("Saved new payment to member register with the following info: {}".format(form))
return HttpResponseRedirect('/members/payments')
else:
print(form.errors)
return HttpResponse('oh shit')
return render(request, 'error.html', {'error': form.errors})
@ensure_csrf_cookie
@require_http_methods(["GET"])