NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
| from oscar.apps.catalogue.abstract_models import AbstractProduct, | |
| from parler.models import TranslatableModel, TranslatedFields | |
| class Product(AbstractProduct, TranslatableModel): | |
| """ | |
| Add translations to the product model. | |
| """ | |
| # Provide translated fields. |
| virtualenv --no-site-packages hodor | |
| hodor/bin/pip install simplejson ujson cbor tnetstring msgpack-python | |
| curl -s 'http://www.json-generator.com/api/json/get/cvfsLVmKiG?indent=2' > test.json | |
| hodor/bin/python shootout.py |
| try: | |
| from django.utils.deprecation import MiddlewareMixin | |
| except ImportError: | |
| MiddlewareMixin = object | |
| class ForceDefaultLanguageMiddleware(MiddlewareMixin): | |
| """ | |
| Ignore Accept-Language HTTP headers | |