[Answer]-Django 1.5 view with related formset (master detail view)

1👍

One way is to hook in to the get_context_data method of the View.

class DetailedView(DetailView):
    model = Model

    def get_context_data(self, **kwargs):
        context = super(DetailedView, self).get_context_data(**kwargs)
        context.update({
            'randomList': ['badgers', 'lightbulbs', 42]
        })
        return context

randomList will now be available in your template. Obviously this is fairly simple but you can pull in any data, forms etc that you want.

Leave a comment