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(
|
position = models.IntegerField(
|
||||||
default=0
|
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:
|
class Meta:
|
||||||
verbose_name = _("Product")
|
verbose_name = _("Product")
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ class ItemFormGeneral(VersionedModelForm):
|
|||||||
'admission',
|
'admission',
|
||||||
'short_description',
|
'short_description',
|
||||||
'long_description',
|
'long_description',
|
||||||
|
'picture',
|
||||||
'default_price',
|
'default_price',
|
||||||
'tax_rate',
|
'tax_rate',
|
||||||
'properties',
|
'properties',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
{% block inside %}
|
{% block inside %}
|
||||||
<form action="" method="post" class="form-horizontal">
|
<form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{% trans "General information" %}</legend>
|
<legend>{% trans "General information" %}</legend>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
{% bootstrap_field form.admission layout="horizontal" %}
|
{% bootstrap_field form.admission layout="horizontal" %}
|
||||||
{% bootstrap_field form.short_description layout="horizontal" %}
|
{% bootstrap_field form.short_description layout="horizontal" %}
|
||||||
{% bootstrap_field form.long_description layout="horizontal" %}
|
{% bootstrap_field form.long_description layout="horizontal" %}
|
||||||
|
{% bootstrap_field form.picture layout="horizontal" %}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>{% trans "Price settings" %}</legend>
|
<legend>{% trans "Price settings" %}</legend>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{% extends "pretixpresale/event/base.html" %}
|
{% extends "pretixpresale/event/base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load thumbnail %}
|
||||||
{% block title %}{% trans "Presale" %}{% endblock %}
|
{% block title %}{% trans "Presale" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -60,6 +61,11 @@
|
|||||||
<div class="item-with-variations">
|
<div class="item-with-variations">
|
||||||
<div class="row-fluid product-row headline">
|
<div class="row-fluid product-row headline">
|
||||||
<div class="col-md-8 col-xs-12">
|
<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">
|
<a href="javascript:void(0);" data-toggle="variations">
|
||||||
<strong>{{ item.name }}</strong>
|
<strong>{{ item.name }}</strong>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ INSTALLED_APPS = (
|
|||||||
'pretix.plugins.paypal',
|
'pretix.plugins.paypal',
|
||||||
'pretix.plugins.ticketoutputpdf',
|
'pretix.plugins.ticketoutputpdf',
|
||||||
'pretix.plugins.sendmail',
|
'pretix.plugins.sendmail',
|
||||||
|
'easy_thumbnails',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
@@ -247,6 +248,12 @@ MESSAGE_TAGS = {
|
|||||||
messages.SUCCESS: 'alert-success',
|
messages.SUCCESS: 'alert-success',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
THUMBNAIL_ALIASES = {
|
||||||
|
'': {
|
||||||
|
'productlist': {'size': (60, 60), 'crop': True},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
loglevel = 'DEBUG' if DEBUG else 'INFO'
|
loglevel = 'DEBUG' if DEBUG else 'INFO'
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ django-bootstrap3>=6.1,<6.2
|
|||||||
django-compressor>=1.5,<2.0
|
django-compressor>=1.5,<2.0
|
||||||
reportlab>=3.1.44,<3.2
|
reportlab>=3.1.44,<3.2
|
||||||
-e git+https://github.com/pretix/PyPDF2.git@pretix#egg=PyPDF2
|
-e git+https://github.com/pretix/PyPDF2.git@pretix#egg=PyPDF2
|
||||||
|
easy-thumbnails>=2.2,<3
|
||||||
|
|
||||||
# Deployment / static file compilation requirements
|
# Deployment / static file compilation requirements
|
||||||
BeautifulSoup4
|
BeautifulSoup4
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
color: @alert-warning-text;
|
color: @alert-warning-text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.productpicture {
|
||||||
|
float: left;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.item-with-variations .product-row.headline, .product-row.simple {
|
.item-with-variations .product-row.headline, .product-row.simple {
|
||||||
border-top: 2px solid @table-border-color;
|
border-top: 2px solid @table-border-color;
|
||||||
|
|||||||
Reference in New Issue
Block a user