python - Django Page Caching (Trouble with db)? -
i'm having bit of odd issue in django 1.2.4.
i have page lets user declare front end settings. these settings represented in following models:
class setting(models.model): """ maintains key-value pair front-end editable setting. """ class meta: abstract = true name = models.charfield(max_length=120, primary_key=true) description = models.charfield(max_length=300, blank=true) class integersetting(setting): value = models.integerfield() class listsetting(setting): value = pickledobjectfield(default=lambda: list(), editable=true)
these settings reflected in admin change form. have overridden template, , make setting available page follows:
{% extends 'admin/change_form.html' %} {% block extrahead %} <script type="application/javascript"> var global= {}; global.min_slider = {{min_slider}}; global.max_slider = {{max_slider}}; </script> {{ block.super }} {% endblock %}
these values provided admin class:
class fooadmin(admin.modeladmin): form = fooadminform min_max = {'min_slider': get_setting("min slider value"), 'max_slider': get_setting("max slider value")} def change_view(self, request, object_id, extra_context=none): extra_context = extra_context or {} extra_context.update(self.min_max) return super(fooadmin, self).change_view(request, object_id, extra_context)
after change setting on settings form, don't see updated on page load of admin change form. however, after restarting dev server, see data fine.
what going on here? running caching issue? if it's caching in admin interface, how can disable 1 page?
the problem defining these @ class level in admin. therefore evaluated when class definition executed, ie @ process startup.
move dictionary definition change_view
method itself.
Comments
Post a Comment