Compare commits

...
7 changed files with 51 additions and 19 deletions
+23 -2
View File
@@ -2,11 +2,32 @@ before_script:
tests: tests:
stage: test stage: test
script: script:
- virtualenv-3.4 env - virtualenv env
- source env/bin/activate - source env/bin/activate
- pip install -U pip wheel setuptools - pip install -U pip wheel setuptools
- XDG_CACHE_HOME=/cache bash .travis.sh style - XDG_CACHE_HOME=/cache bash .travis.sh style
- XDG_CACHE_HOME=/cache bash .travis.sh tests - XDG_CACHE_HOME=/cache bash .travis.sh tests
- XDG_CACHE_HOME=/cache bash .travis.sh doctests
tags: tags:
- python3 - python3
pypi:
stage: release
script:
- cp /keys/.pypirc ~/.pypirc
- virtualenv env
- source env/bin/activate
- pip install -U pip wheel setuptools
- XDG_CACHE_HOME=/cache pip3 install -Ur src/requirements.txt -r src/requirements/dev.txt -r src/requirements/py34.txt
- cd src
- python setup.py sdist upload
- python setup.py bdist_wheel upload
tags:
- python3
only:
- release
artifacts:
paths:
- src/dist/
stages:
- test
- build
- release
+1 -1
View File
@@ -1 +1 @@
__version__ = "1.3.0" __version__ = "1.3.1"
+17 -2
View File
@@ -2,6 +2,7 @@ import copy
from django import forms from django import forms
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db.models import Max
from django.forms import BooleanField, ModelMultipleChoiceField from django.forms import BooleanField, ModelMultipleChoiceField
from django.forms.formsets import DELETION_FIELD_NAME from django.forms.formsets import DELETION_FIELD_NAME
from django.utils.translation import ugettext as __, ugettext_lazy as _ from django.utils.translation import ugettext as __, ugettext_lazy as _
@@ -120,7 +121,20 @@ class ItemCreateForm(I18nModelForm):
) )
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if self.cleaned_data.get('copy_from'):
self.instance.description = self.cleaned_data['copy_from'].description
self.instance.active = self.cleaned_data['copy_from'].active
self.instance.available_from = self.cleaned_data['copy_from'].available_from
self.instance.available_until = self.cleaned_data['copy_from'].available_until
self.instance.require_voucher = self.cleaned_data['copy_from'].require_voucher
self.instance.hide_without_voucher = self.cleaned_data['copy_from'].hide_without_voucher
self.instance.allow_cancel = self.cleaned_data['copy_from'].allow_cancel
self.instance.min_per_order = self.cleaned_data['copy_from'].min_per_order
self.instance.max_per_order = self.cleaned_data['copy_from'].max_per_order
self.instance.position = (self.event.items.aggregate(p=Max('position'))['p'] or 0) + 1
instance = super().save(*args, **kwargs) instance = super().save(*args, **kwargs)
if self.cleaned_data.get('has_variations'): if self.cleaned_data.get('has_variations'):
if self.cleaned_data.get('copy_from') and self.cleaned_data.get('copy_from').has_variations: if self.cleaned_data.get('copy_from') and self.cleaned_data.get('copy_from').has_variations:
for variation in self.cleaned_data['copy_from'].variations.all(): for variation in self.cleaned_data['copy_from'].variations.all():
@@ -131,8 +145,9 @@ class ItemCreateForm(I18nModelForm):
item=instance, value=__('Standard') item=instance, value=__('Standard')
) )
for question in Question.objects.filter(items=self.cleaned_data.get('copy_from')): if self.cleaned_data.get('copy_from'):
question.items.add(instance) for question in self.cleaned_data['copy_from'].questions.all():
question.items.add(instance)
return instance return instance
+1 -13
View File
@@ -4,7 +4,7 @@ from django.contrib import messages
from django.core.files import File from django.core.files import File
from django.core.urlresolvers import resolve, reverse from django.core.urlresolvers import resolve, reverse
from django.db import transaction from django.db import transaction
from django.db.models import Count, F, Max, Q from django.db.models import Count, F, Q
from django.forms.models import ModelMultipleChoiceField, inlineformset_factory from django.forms.models import ModelMultipleChoiceField, inlineformset_factory
from django.http import Http404, HttpResponseRedirect from django.http import Http404, HttpResponseRedirect
from django.shortcuts import redirect from django.shortcuts import redirect
@@ -792,18 +792,6 @@ class ItemCreate(EventPermissionRequiredMixin, CreateView):
@transaction.atomic @transaction.atomic
def form_valid(self, form): def form_valid(self, form):
messages.success(self.request, _('Your changes have been saved.')) messages.success(self.request, _('Your changes have been saved.'))
if form.cleaned_data['copy_from']:
form.instance.description = form.cleaned_data['copy_from'].description
form.instance.active = form.cleaned_data['copy_from'].active
form.instance.available_from = form.cleaned_data['copy_from'].available_from
form.instance.available_until = form.cleaned_data['copy_from'].available_until
form.instance.require_voucher = form.cleaned_data['copy_from'].require_voucher
form.instance.hide_without_voucher = form.cleaned_data['copy_from'].hide_without_voucher
form.instance.allow_cancel = form.cleaned_data['copy_from'].allow_cancel
form.instance.min_per_order = form.cleaned_data['copy_from'].min_per_order
form.instance.max_per_order = form.cleaned_data['copy_from'].max_per_order
form.instance.position = (self.request.event.items.aggregate(p=Max('position'))['p'] or 0) + 1
ret = super().form_valid(form) ret = super().form_valid(form)
form.instance.log_action('pretix.event.item.added', user=self.request.user, data={ form.instance.log_action('pretix.event.item.added', user=self.request.user, data={
+4
View File
@@ -39,6 +39,10 @@ class Paypal(BasePaymentProvider):
('client_id', ('client_id',
forms.CharField( forms.CharField(
label=_('Client ID'), label=_('Client ID'),
help_text=_('<a target="_blank" href="{docs_url}">{text}</a>').format(
text=_('Click here for a tutorial on how to obtain the required keys'),
docs_url='https://docs.pretix.eu/en/latest/user/payments/paypal.html'
)
)), )),
('secret', ('secret',
forms.CharField( forms.CharField(
+4
View File
@@ -28,6 +28,10 @@ class Stripe(BasePaymentProvider):
('secret_key', ('secret_key',
forms.CharField( forms.CharField(
label=_('Secret key'), label=_('Secret key'),
help_text=_('<a target="_blank" href="{docs_url}">{text}</a>').format(
text=_('Click here for a tutorial on how to obtain the required keys'),
docs_url='https://docs.pretix.eu/en/latest/user/payments/stripe.html'
)
)), )),
('publishable_key', ('publishable_key',
forms.CharField( forms.CharField(
@@ -79,7 +79,7 @@ class PdfTicketOutput(BaseTicketOutput):
p.drawString(code_x * units.mm, code_y * units.mm, op.secret) p.drawString(code_x * units.mm, code_y * units.mm, op.secret)
attendee_s = self.settings.get('attendee_s', default=0, as_type=float) attendee_s = self.settings.get('attendee_s', default=0, as_type=float)
if code_s and op.attendee_name: if attendee_s and op.attendee_name:
p.setFont("Helvetica", attendee_s) p.setFont("Helvetica", attendee_s)
attendee_x = self.settings.get('attendee_x', default=15, as_type=float) attendee_x = self.settings.get('attendee_x', default=15, as_type=float)
attendee_y = self.settings.get('attendee_y', default=90, as_type=float) attendee_y = self.settings.get('attendee_y', default=90, as_type=float)