Issue #449: Display and change order locale (#459)

* Add more security headers (#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
This commit is contained in:
Jahongir
2017-04-11 13:45:46 +05:00
committed by Raphael Michel
parent 984d5c716b
commit ccb981e6ce
7 changed files with 114 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.formats import localize
@@ -118,3 +119,15 @@ class OrderContactForm(forms.ModelForm):
class Meta:
model = Order
fields = ['email']
class OrderLocaleForm(forms.ModelForm):
locale = forms.ChoiceField()
class Meta:
model = Order
fields = ['locale']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['locale'].choices = [(a, a) for a in self.instance.event.settings.locales]