Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Merge eetvoudig into eetFestijn #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ language: python
dist: xenial

python:
- "3.6"
- "3.7"

addons:
apt:
packages:
- language-pack-nl

install:
- pip install --upgrade pip setuptools
- pip install -r requirements.txt
- pip install -r dev-requirements.txt
- pip install coveralls
before_install:
- pip install --upgrade setuptools
- pip install poetry

install:
- poetry install
- poetry add coveralls
script:
- python manage.py test
- coverage run --source=orders --omit="*/migrations/*" manage.py test
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ eetFestijn makes it easy to collect take-away orders for a large group. It is es
## Dependencies

The dependencies of eetFestijn are listed in the `requirements.txt` file. Since introducing the 'export to PDF' functionality, the number of dependencies has steeply grown. In order to be able to export PDFs, eetFestijn uses the [WeasyPrint](http://weasyprint.org/) library, converting HTML/CSS to print-ready PDF documents. Unfortunately, the dependencies of WeasyPrint are not all that straightforward. When running `pip install -r requirements.txt`, one might run into any number of the errors involving missing header files. Luckily, they can be trivially fixed by installing a number of development packages. On Debian-based systems, this can be achieved by calling `apt-get install libffi-dev libxml2-dev libxslt1-dev zlib1g-dev`.
On macOS you may need to execute `brew install cairo pango`.

After succesfully installing the requirements, you might be faced with an error thrown by Django: `ImportError: cannot import name properties`. In that case, you may need to install `lib-pango`, as follows: `apt-get install libpango1.0-0`. Or use `brew install cairo pango` if you're on macOS.

Expand Down
1 change: 0 additions & 1 deletion dev-requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions eetfestijn/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'django.contrib.staticfiles',
'bootstrap3',
'orders',
'meals',
'wiebetaaltwat',
]

Expand Down
5 changes: 4 additions & 1 deletion eetfestijn/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from django.conf.urls import include
from django.contrib import admin
from django.urls import path
from django.views.generic import TemplateView

urlpatterns = [
path('admin/', admin.site.urls),
path('wiebetaaltwat/', include('wiebetaaltwat.urls')),
path('', include('orders.urls')),
path('fest/', include('orders.urls')),
path('split/', include('meals.urls')),
path('', TemplateView.as_view(template_name='eetfestijn/index.html'))
]
Empty file added meals/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions meals/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin
from meals.models import Meal, Bystander

admin.site.register(Meal)
admin.site.register(Bystander)
37 changes: 37 additions & 0 deletions meals/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from django.forms import ModelForm, widgets
import django.forms as forms
from meals.models import Meal, Bystander
from wiebetaaltwat.models import Participant


class EuroWidget(widgets.NumberInput):

def render(self, name, value, attrs=None):
return ('<div class="input-group">\
<span class="input-group-addon">€-cent</span>' +
super(EuroWidget, self).render(name, value, attrs) +
'</div>')

def value_from_datadict(self, data, files, name):
return data[name]


class ParticipantForm(forms.Form):
participant = forms.ModelChoiceField(label='Participant',
queryset=Participant.objects.all())


class BystanderForm(ModelForm):
class Meta:
model = Bystander
fields = ['name']
labels = {'name': 'Name bystander'}


class MealForm(ModelForm):
class Meta:
model = Meal
fields = ['description', 'price', 'payer']
labels = {'description': 'Description',
'price': 'Price'}
widgets = {'price': EuroWidget()}
84 changes: 84 additions & 0 deletions meals/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
]

operations = [
migrations.CreateModel(
name='Bystander',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('name', models.CharField(max_length=200)),
],
),
migrations.CreateModel(
name='Meal',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('price', models.IntegerField(default=0)),
('date', models.DateTimeField(auto_now=True)),
('completed', models.BooleanField(default=False)),
('description', models.CharField(max_length=200, blank=True)),
('bystanders', models.ManyToManyField(to='meals.Bystander', blank=True)),
],
),
migrations.CreateModel(
name='Participant',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('wbw_id', models.IntegerField(unique=True)),
],
),
migrations.CreateModel(
name='Participation',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('name', models.CharField(max_length=200)),
('participant', models.ForeignKey(to='meals.Participant', on_delete=models.CASCADE)),
],
),
migrations.CreateModel(
name='Wbw_list',
fields=[
('id', models.AutoField(auto_created=True, serialize=False, verbose_name='ID', primary_key=True)),
('list_id', models.IntegerField(unique=True)),
('name', models.CharField(max_length=200, blank=True)),
],
),
migrations.AddField(
model_name='participation',
name='wbw_list',
field=models.ForeignKey(to='meals.Wbw_list', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='participant',
name='wbw_list',
field=models.ManyToManyField(to='meals.Wbw_list', through='meals.Participation'),
),
migrations.AddField(
model_name='meal',
name='participants',
field=models.ManyToManyField(to='meals.Participant', blank=True),
),
migrations.AddField(
model_name='meal',
name='payer',
field=models.ForeignKey(related_name='paymeal', blank=True, to='meals.Participant', null=True, on_delete=models.SET_NULL),
),
migrations.AddField(
model_name='meal',
name='wbw_list',
field=models.ForeignKey(null=True, to='meals.Wbw_list', on_delete=models.CASCADE),
),
migrations.AddField(
model_name='bystander',
name='participant',
field=models.ForeignKey(to='meals.Participant', on_delete=models.CASCADE),
),
]
24 changes: 24 additions & 0 deletions meals/migrations/0002_auto_20161006_1640.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('meals', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='wbw_list',
name='list_id',
field=models.CharField(max_length=40, unique=True),
),
migrations.AlterField(
model_name='participant',
name='wbw_id',
field=models.CharField(max_length=40, unique=True),
),
]
54 changes: 54 additions & 0 deletions meals/migrations/0003_auto_20191020_2107.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by Django 2.0.13 on 2019-10-20 19:07

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('meals', '0002_auto_20161006_1640'),
]

operations = [
migrations.RemoveField(
model_name='participant',
name='wbw_list',
),
migrations.RemoveField(
model_name='participation',
name='participant',
),
migrations.RemoveField(
model_name='participation',
name='wbw_list',
),
migrations.RemoveField(
model_name='meal',
name='wbw_list',
),
migrations.AlterField(
model_name='bystander',
name='participant',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wiebetaaltwat.Participant'),
),
migrations.AlterField(
model_name='meal',
name='participants',
field=models.ManyToManyField(blank=True, to='wiebetaaltwat.Participant'),
),
migrations.AlterField(
model_name='meal',
name='payer',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='paymeal', to='wiebetaaltwat.Participant'),
),
migrations.DeleteModel(
name='Participant',
),
migrations.DeleteModel(
name='Participation',
),
migrations.DeleteModel(
name='Wbw_list',
),
]
Empty file added meals/migrations/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions meals/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.db import models

from wiebetaaltwat.models import Participant


class Bystander(models.Model):
name = models.CharField(max_length=200)
participant = models.ForeignKey(Participant, on_delete=models.CASCADE)


class Meal(models.Model):
price = models.IntegerField(default=0)
date = models.DateTimeField(auto_now=True)
completed = models.BooleanField(default=False)
description = models.CharField(max_length=200, blank=True)

participants = models.ManyToManyField(Participant, blank=True)
bystanders = models.ManyToManyField(Bystander, blank=True)
payer = models.ForeignKey(Participant, null=True, blank=True, related_name='paymeal', on_delete=models.SET_NULL)
3 changes: 3 additions & 0 deletions meals/static/meals/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$(function () {
$('[data-toggle="tooltip"]').tooltip({container: 'body'});
})
35 changes: 35 additions & 0 deletions meals/static/meals/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
body {
background-color: #f5f5f5;
text-align:justify;
}

#content {
padding: 20px 30px 30px;
margin: 40px auto;
background-color: #fff;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

form#startform {
text-align:center;
}

.footer {
text-align:center;
font-size: 12px;
}

.footer a {
color: #999;
}

.footer a:hover, .footer a:focus {
color: #333;
text-decoration: none;
}
Loading