Commit c9abba9c authored by Nienke's avatar Nienke

Make merchandise page

parent 60b10f8f
from django.contrib import admin
from .models import MerchandiseItem
admin.site.register(MerchandiseItem)
from django.apps import AppConfig
class MerchandiseConfig(AppConfig):
name = 'merchandise'
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-05 15:05
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MerchandiseItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('price', models.DecimalField(decimal_places=2, max_digits=5)),
('description', models.TextField()),
('image', models.ImageField(upload_to='merchandise')),
],
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-05 15:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('merchandise', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='merchandiseitem',
name='image',
field=models.ImageField(upload_to='public/merchandise'),
),
]
from django.db import models
class MerchandiseItem(models.Model):
name = models.CharField(max_length=200)
price = models.DecimalField(max_digits=5, decimal_places=2)
description = models.TextField()
image = models.ImageField(upload_to='public/merchandise')
def __str__(self):
return self.name
{% extends 'base.html' %}
{% load staticfiles %}
{% load i18n %}
{% block page_title %}{% trans "Merchandise" %}{% endblock %}
{% block body %}
<h1>Merchandise</h1><p>Hieronder kun je vast zien welke merchandise er te koop is bij Thalia. Elke pauze zijn de spullen te koop bij de bestuurskamer (HG00.150), daarbuiten zijn ze op afspraak te verkrijgen of tijdens borrels bij het bestuur.</p>
{% for item in items %}
<hr class="separator">
<div class="post" id="item">
<div class="row">
<div class="span3" id="merchandise-image">
<img src="{{ item.image.url }}" alt="" id="image">
</div>
<div class="span9" id="merchandise-text">
<h1 id="merchandise-title">{{ item.name }}</h1>
<p id="merchandise-desc">{{ item.description }}</p>
<div id="merchandise-price">Prijs: € {{ item.price }}</div>
</div>
</div>
</div>
{% endfor %}
{% endblock %}
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
]
from django.shortcuts import render
from .models import MerchandiseItem
def index(request):
items = MerchandiseItem.objects.all()
return render(request,
'merchandise/index.html',
{'items': items})
......@@ -7,6 +7,7 @@ main = [
{'title': _('Committees'), 'name': 'committees:index'},
{'title': _('Members'), 'name': '#'},
{'title': _('Documents'), 'name': 'documents:index'},
{'title': _('Merchandise'), 'name': 'merchandise:index'},
{'title': _('Members'), 'name': '#'},
{'title': _('Sister Associations'), 'name': 'sister-associations'},
{'title': _('Become a Member'), 'name': 'become-a-member'},
......
......@@ -48,6 +48,7 @@ INSTALLED_APPS = [
'committees',
'photos',
'utils',
'merchandise',
]
MIDDLEWARE = [
......
......@@ -31,6 +31,7 @@ urlpatterns = [
url(r'^nyi$', TemplateView.as_view(template_name='status/nyi.html'), name='#'),
url(r'^association/', include([
url(r'^committees/', include('committees.urls', namespace='committees')),
url(r'^merchandise/', include('merchandise.urls', namespace='merchandise')),
url(r'^documents/', include('documents.urls', namespace='documents')),
url(r'^become-a-member/', members.views.become_a_member, name='become-a-member'),
url(r'^sister-associations', TemplateView.as_view(template_name='singlepages/sister_associations.html'), name='sister-associations'),
......
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