Additional context for class based views through urlconf

I thought there was a simpler method of adding context through the urlconf but after having a look at the source this is what I came up with. Apparently there's only get_context_data() so I used a lambda to add what I needed.

Update: I should probably have used extra_context={'model': 'Frontpage'}

        get_context_data=lambda: {'model': 'Frontpage'},
Published on July 31, 2012 at 4:53 p.m. by Nicolas and tagged Django, CBV, context. You can follow the discussion with the comment feed for this post. Feeling generous? Donate!

1 comment

  1. avatar
    wrote this comment on
    Thank you!

Start a new thread

Cancel reply
Markdown. Syntax highlighting with <code lang="php"><?php echo "Hello, world!"; ?></code> etc.