I have a view that the model requests to fill out a form:
class AddServerForm(forms.Form):
…snip…
hwChoices = HardwareConfig.objects.\
values_list('name','description').order_by('name')
hwChoices = [('', '----- SELECT ONE -----')] +\
[ (x,'{0} - {1}'.format(x,y)) for x,y in hwChoices ]
hwconfig = forms.ChoiceField(label='Hardware Config', choices=hwChoices)
…snip…
def addServers(request, template="manager/add_servers.html",
template_success="manager/add_servers_success.html"):
if request.method == 'POST':
else:
addForm = AddServerForm()
return render_to_response(template, dict(addForm=addForm),
context_instance=RequestContext(request))
Additions to the HardwareConfig model are made using the administrator interface. Changes are displayed directly in the admin interface, as expected.
Running the query through the shell returns all the results as expected:
michael@victory> python manage.py shell
Python 2.6 (r26:66714, Feb 21 2009, 02:16:04)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from serverbuild.base.models import HardwareConfig
>>> hwChoices = HardwareConfig.objects.\
... values_list('name','description').order_by('name')
hwChoices now contains a complete set of results.
However, loading the addServers view (see above) returns the old result set without skipping the newly added records.
I need to restart the web server so that the changes are displayed, which makes me think that this request is cached somewhere.
- I do nothing in explicit caching (
grep -ri cache /project/rootreturns nothing) - , - -, .
?
:
- MySQLdb: 1.2.2
- django: 1.2.5
- python: 2.6