mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Added product pictures
This commit is contained in:
19
src/pretix/base/migrations/0005_item_picture.py
Normal file
19
src/pretix/base/migrations/0005_item_picture.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('pretixbase', '0004_eventpermission_can_change_permissions'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='item',
|
||||
name='picture',
|
||||
field=models.ImageField(upload_to='', null=True, verbose_name='Product picture', blank=True),
|
||||
),
|
||||
]
|
||||
@@ -875,6 +875,14 @@ class Item(Versionable):
|
||||
position = models.IntegerField(
|
||||
default=0
|
||||
)
|
||||
picture = models.ImageField(
|
||||
verbose_name=_("Product picture"),
|
||||
null=True, blank=True,
|
||||
upload_to=lambda instance, filename: '%s/%s/item-%s.%s' % (
|
||||
instance.event.organizer.slug, instance.event.slug, instance.identity,
|
||||
filename.split('.')[-1]
|
||||
)
|
||||
)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("Product")
|
||||
|
||||
@@ -128,6 +128,7 @@ class ItemFormGeneral(VersionedModelForm):
|
||||
'admission',
|
||||
'short_description',
|
||||
'long_description',
|
||||
'picture',
|
||||
'default_price',
|
||||
'tax_rate',
|
||||
'properties',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{% load i18n %}
|
||||
{% load bootstrap3 %}
|
||||
{% block inside %}
|
||||
<form action="" method="post" class="form-horizontal">
|
||||
<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
<legend>{% trans "General information" %}</legend>
|
||||
@@ -12,6 +12,7 @@
|
||||
{% bootstrap_field form.admission layout="horizontal" %}
|
||||
{% bootstrap_field form.short_description layout="horizontal" %}
|
||||
{% bootstrap_field form.long_description layout="horizontal" %}
|
||||
{% bootstrap_field form.picture layout="horizontal" %}
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>{% trans "Price settings" %}</legend>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "pretixpresale/event/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load thumbnail %}
|
||||
{% block title %}{% trans "Presale" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -60,6 +61,11 @@
|
||||
<div class="item-with-variations">
|
||||
<div class="row-fluid product-row headline">
|
||||
<div class="col-md-8 col-xs-12">
|
||||
{% if item.picture %}
|
||||
<img src="{{ item.picture|thumbnail_url:'productlist' }}"
|
||||
class="productpicture"
|
||||
alt="{{ item.name }}" />
|
||||
{% endif %}
|
||||
<a href="javascript:void(0);" data-toggle="variations">
|
||||
<strong>{{ item.name }}</strong>
|
||||
</a>
|
||||
|
||||
@@ -137,6 +137,7 @@ INSTALLED_APPS = (
|
||||
'pretix.plugins.paypal',
|
||||
'pretix.plugins.ticketoutputpdf',
|
||||
'pretix.plugins.sendmail',
|
||||
'easy_thumbnails',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
@@ -247,6 +248,12 @@ MESSAGE_TAGS = {
|
||||
messages.SUCCESS: 'alert-success',
|
||||
}
|
||||
|
||||
THUMBNAIL_ALIASES = {
|
||||
'': {
|
||||
'productlist': {'size': (60, 60), 'crop': True},
|
||||
},
|
||||
}
|
||||
|
||||
loglevel = 'DEBUG' if DEBUG else 'INFO'
|
||||
|
||||
LOGGING = {
|
||||
|
||||
@@ -9,6 +9,7 @@ django-bootstrap3>=6.1,<6.2
|
||||
django-compressor>=1.5,<2.0
|
||||
reportlab>=3.1.44,<3.2
|
||||
-e git+https://github.com/pretix/PyPDF2.git@pretix#egg=PyPDF2
|
||||
easy-thumbnails>=2.2,<3
|
||||
|
||||
# Deployment / static file compilation requirements
|
||||
BeautifulSoup4
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
color: @alert-warning-text;
|
||||
}
|
||||
}
|
||||
|
||||
.productpicture {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
.item-with-variations .product-row.headline, .product-row.simple {
|
||||
border-top: 2px solid @table-border-color;
|
||||
|
||||
Reference in New Issue
Block a user