forked from fossasia/eventyay-tickets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue fossasia#449: Display and change order locale (fossasia#459)
* Add more security headers (fossasia#458) * Include some missing security headers This change adds the following security headers: * X-Content-Type-Options to prevent content type sniffing * Referrer-Policy to prevent leaking referrer information when navigating away from the instance * Migrate from Docker sample to manual configuration Migrate the additional security headers from the Docker configuration sample to the manual configuration guide. Add DS_Store to gitingore * Show order locale in order details * Add OrderLocaleChange view and OrderLocaleForm Refactor OrderLocaleForm. Add test
- Loading branch information
Showing
7 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,6 @@ pretixeu/ | |
local/ | ||
.project | ||
.pydevproject | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/pretix/control/templates/pretixcontrol/order/change_locale.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends "pretixcontrol/event/base.html" %} | ||
{% load i18n %} | ||
{% load bootstrap3 %} | ||
{% block title %} | ||
{% trans "Change locale information" %} | ||
{% endblock %} | ||
{% block content %} | ||
<h1> | ||
{% trans "Change locale information" %} | ||
</h1> | ||
<p> | ||
This language will be used whenever emails are sent to the users. | ||
</p> | ||
|
||
<form method="post" class="form-horizontal" href=""> | ||
{% csrf_token %} | ||
<input type="hidden" name="status" value="c" /> | ||
{% bootstrap_form form layout='horizontal' %} | ||
<div class="form-group submit-group"> | ||
<a class="btn btn-default btn-lg" | ||
href="{% url "control:event.order" event=request.event.slug organizer=request.event.organizer.slug code=order.code %}"> | ||
{% trans "Cancel" %} | ||
</a> | ||
<button class="btn btn-primary btn-save btn-lg" type="submit"> | ||
{% trans "Save" %} | ||
</button> | ||
<div class="clearfix"></div> | ||
</div> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ def env(): | |
category=None, default_price=23, | ||
admission=True) | ||
event.settings.set('attendee_names_asked', True) | ||
event.settings.set('locales', ['en', 'de']) | ||
OrderPosition.objects.create( | ||
order=o, | ||
item=ticket, | ||
|
@@ -104,6 +105,30 @@ def test_order_set_contact(client, env): | |
assert o.email == '[email protected]' | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_order_set_locale(client, env): | ||
q = Quota.objects.create(event=env[0], size=0) | ||
q.items.add(env[3]) | ||
client.login(email='[email protected]', password='dummy') | ||
client.post('/control/event/dummy/dummy/orders/FOO/locale', { | ||
'locale': 'de' | ||
}) | ||
o = Order.objects.get(id=env[2].id) | ||
assert o.locale == 'de' | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_order_set_locale_with_invalid_locale_value(client, env): | ||
q = Quota.objects.create(event=env[0], size=0) | ||
q.items.add(env[3]) | ||
client.login(email='[email protected]', password='dummy') | ||
client.post('/control/event/dummy/dummy/orders/FOO/locale', { | ||
'locale': 'fr' | ||
}) | ||
o = Order.objects.get(id=env[2].id) | ||
assert o.locale == 'en' | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_order_set_comment(client, env): | ||
q = Quota.objects.create(event=env[0], size=0) | ||
|