On Tue, Jul 15, 2008 at 5:36 AM, vicvicvic <[EMAIL PROTECTED]> wrote: > > In the Django FAQ, we can read this about views: > >> In our interpretation of MVC, the "view" describes the data that gets >> presented to the user. It's not necessarily how the data looks, but which >> data is presented. The view describes which data you see, not how you see >> it. It's a subtle distinction. > > In my mind, "which data you see" would be equal to a context a view > returns, not the HttpResponse or the template. Why? Because rendering > a template is saying "I have this data and I want it presented the way > this template will present it". If the view is responsible for saying > that, it is at least partly responsible for telling us how we see the > data.
If a view picks a template and renders it using some data, the template is still free to present the data any way it likes (with some Content-Type related restrictions). But you don't have to hard-wire the template (and the implicit Content-Type) in the view. Write a view that has (optional) arguments (with sensible defaults) for the template (and the Content-Type). > Right now, I have a couple of views which return some data. But I'm > also building another view, and I want the data from one of the first > views in this one. I can either duplicate the fetching from the first > one, or I can send an "internal" request and just get the dataset. I > pick WHICH data I want and add some to it. Or you could write a function that fetches and returns it, and use that function in both views. Arien --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---