On Mon, Apr 13, 2009 at 11:17 AM, Tonne <pascal.bomp...@gmail.com> wrote:
> In my case I need to firstly update a 3 dimensional dict/list (i.e. > nested 3 levels deep - not sure if 3 dimensional is an appropriate > description), then iterate over it and put those results into an html > page. I'm probably not looking hard enough, but I can't quite seem to > grasp how to achieve this with traditional Django views and Django > templates. Couldn't you do that with three nested for loops in the template? See: http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for I'd prefer to solve the problem the Django way. The problem for me is > that what I'm trying to do is not the usual scenario of passing the > results of query through a view to a template. I haven't found a > precedent in the docs or a tutorial elsewhere that covers this. Well, what does the updating of the dict consist of? Even if it depends on the date or on other external factors, it could happen in the view. Unless updating it is only necessary once a day and takes a lot of computing power. In that case you could run it with a cronjob [1] or any other scheduled task, once a day, and save the data into a file or db. Remember that Django can be used as what you refer to as 'freeform' python as well. You are totally free to import parts of django into an external python script, and in that way make use of django's models etc. (Only make sure to set DJANGO_SETTINGS_MODULE in your script [2]) [1] http://en.wikipedia.org/wiki/Cron [2] http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ TiNo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---