From cfe998046e6af751150a29692b1888e19ef74510 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 3 Mar 2013 11:36:57 +0100 Subject: [PATCH 1/3] Fixed a couple of things in the README. --- README.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 833ae24..c209a7a 100644 --- a/README.rst +++ b/README.rst @@ -122,6 +122,8 @@ you need to install this library, too. E.g.:: pip install django-picklefield +Alternatively follow the backend specific installation instructions above. + The database backend has the ability to automatically cache the config values and clear them when saving. You need to set the following setting to enable this feature:: @@ -132,7 +134,7 @@ to enable this feature:: cross-process caching, because correct cache invalidation can't be guaranteed. -Starting in Django 1.3 you can alternatively be the name of an entry of +Starting in Django 1.3 you can alternatively use the name of an entry of the ``CACHES`` setting. E.g.:: CACHES = { @@ -173,11 +175,11 @@ Constance can be used from your Python code and from your Django templates. To access the config object from your template, you can either pass the object to the template context:: - from django.shortcuts import render_to_response + from django.shortcuts import render from constance import config def myview(request): - return render_to_response('my_template.html', {'config': config}) + return render(request, 'my_template.html', {'config': config}) Or you can use the included config context processor.:: From 5354f1f3917cfbf5fb59aa2ed5950960aadb3b48 Mon Sep 17 00:00:00 2001 From: Silvan Spross Date: Wed, 6 Mar 2013 16:49:59 +0100 Subject: [PATCH 2/3] fixed template typo in readme --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c209a7a..1c239e3 100644 --- a/README.rst +++ b/README.rst @@ -194,7 +194,7 @@ Constance can be used from your Python code and from your Django templates. Then, in your template you can refer to the config values just as any other variable, e.g.:: -

Welcome on {% config.SITE_NAME %}

+

Welcome on {{ config.SITE_NAME }}

{% if config.BETA_LAUNCHED %} Woohoo! Head over here to use the beta. {% else %} From 847ba5a0608292ed64cbae97ddab359d0a4d8c39 Mon Sep 17 00:00:00 2001 From: Bouke Haarsma Date: Tue, 19 Mar 2013 11:38:37 +0100 Subject: [PATCH 3/3] Robust key fetching Fixes #31 --- constance/backends/database/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/constance/backends/database/__init__.py b/constance/backends/database/__init__.py index 7f96e2c..77bd284 100644 --- a/constance/backends/database/__init__.py +++ b/constance/backends/database/__init__.py @@ -37,10 +37,10 @@ class DatabaseBackend(Backend): def mget(self, keys): if not keys: return - prefixed_keys = [self.add_prefix(key) for key in keys] - stored = self._model._default_manager.filter(key__in=prefixed_keys) - for key, const in itertools.izip(keys, stored): - yield key, const.value + keys = dict((self.add_prefix(key), key) for key in keys) + stored = self._model._default_manager.filter(key__in=keys.keys()) + for const in stored: + yield keys[const.key], const.value def get(self, key): key = self.add_prefix(key)