Timothy, The "get_context_data" is called in *get* method, once you override it "get_context_data" isn't called anymore.
You can see in http://ccbv.co.uk/projects/Django/1.4/django.views.generic.edit/CreateView/ []'s Lucas Magnum. 2013/11/22 Timothy W. Cook <t...@mlhim.org> > I am trying to setup some context variable for use in a template when > I execute a create view. > > class ReviewTitleCreateView(CreateView): > model = Review > form_class = ReviewTitleCreateForm > template_name = 'papers/review_title.html' > > def get_context_data(self, **kwargs): > context = super(ReviewTitleCreateView, > self).get_context_data(**kwargs) > context['title'] = self.paper__title > print('Title: ',self.paper__title) > return context > > > def get(self, request, *args, **kwargs): > form = self.form_class(initial=self.initial) > return render(request, self.template_name, {'form': form}) > > def post(self, request, *args, **kwargs): > form = self.form_class(request.POST) > if form.is_valid(): > # <process form cleaned data> > form.save() > return HttpResponseRedirect('#') > > return render(request, self.template_name, {'form': form}) > > The 'Title: ' isn't even printed in the terminal nor is it available > in the template. Well, it is available I suppose (there is no error) > but empty. > > The Review model: > class Review(models.Model): > """ > A review at a specific stage of one paper. > """ > INCLUDE_CHOICES = [(True,'Include'),(False,'Exclude')] > STAGES = [('Selection by Title','Selection by Title'),('Selection > by Abstract','Selection by Abstract'), ('Selection by Full > Text','Selection by Full Text')] > > paper = models.ForeignKey(Paper, verbose_name=_('Paper'), > related_name="%(app_label)s_%(class)s_related", null=False, > blank=False, help_text=_("The reviewed paper.")) > > include = models.NullBooleanField("Choice", > choices=INCLUDE_CHOICES, default=True, null=False, blank=False, > help_text="Select Include or Exclude for this stage of review.") > > exclusion_choice = models.ForeignKey(Exclusion, null=True, > blank=True, related_name="%(app_label)s_%(class)s_related") > > exclusion_text = models.TextField(null=True, blank=True) > > def __str__(self): > return self.paper.title > > =================================== > > Thoughts? > > > > > > > -- > MLHIM VIP Signup: http://goo.gl/22B0U > ============================================ > Timothy Cook, MSc +55 21 94711995 > MLHIM http://www.mlhim.org > Like Us on FB: https://www.facebook.com/mlhim2 > Circle us on G+: http://goo.gl/44EV5 > Google Scholar: http://goo.gl/MMZ1o > LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook > > -- > 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%3DOU3UmCCE-Dd%3DdjdVgCUpwG8N7DL37zXx_C3hWZCrbeV2C7Q%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/CAAB7jOxez1Zc10ByvR5gXgr65xKMc%3Dg7ASD4KJz33oRQt9UC1Q%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.