I need to format some data in a queryset before it's displayed in the view. It's a date_based.object_detail wrapper.
I am trying to change some "[code]" tags into divs, the example is self-explainitory: def blog_post(request, year, month, day, slug): queryset = Post.objects.all() from string import replace for item in queryset: item.body = replace(str(item.body), "[code]", "<div class='codebox'><div class='codetext'>") item.body = replace(str(item.body), "[/code]", "</div></div>") date_field = 'pub_date' return object_detail(request, year, month, day, queryset, date_field, month_format='%b', day_format='%d', object_id=None, slug=slug, slug_field='slug', extra_context={"latest_10" : Post.objects.order_by('pub_date')[0:10]}) This doesn't throw any errors, but it doesn't render the changes. If i save the changes to the database, it renders fine, however i dont really want to change the data in the db, just render it differently: this works: def blog_post(request, year, month, day, slug): blog_posts = Post.objects.all() from string import replace for item in blog_posts: item.body = replace(str(item.body), "[code]", "<div class='codebox'><div class='codetext'>") item.body = replace(str(item.body), "[/code]", "</div></div>") item.save() queryset = blog_posts date_field = 'pub_date' return object_detail(request, year, month, day, queryset, date_field, month_format='%b', day_format='%d', object_id=None, slug=slug, slug_field='slug', extra_context={"latest_10" : Post.objects.order_by('pub_date')[0:10]}) I don't want to save this data as i want the "[code]" tags to appear again when editing a post. Any ideas? --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---