THanks Lucas and Daniel,

On Fri, Nov 22, 2013 at 11:38 AM, Daniel Roseman <dan...@roseman.org.uk> wrote:
> On Friday, 22 November 2013 13:13:46 UTC, Timothy W. Cook wrote:

> You've added it to kwargs, but you haven't passed kwargs as the template
> context - you've simply hard-coded that to `{'form': form}`.

I 'think' I am starting to understand better.

    def get(self, request, *args, **kwargs):
        paper = Paper.objects.filter(id=kwargs['pk'])
        kwargs['title'] = paper[0].title
        kwargs['form'] = self.form_class(initial=self.initial)
        return render(request, self.template_name, kwargs)

This works.  However, what is the preferred/best practices way to do
this, using get_context_data() or just overriding get().  Does it
really matter?

Thanks,
Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3VUSTXQKX7QCs56KqRF5JKK4uMSOoGD35s-GQJWa%3D2wbg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to