Re: Capture URL values in a CBV

2020-04-17 Thread Tim Johnson
Wham! That is what I was looking for. From a class-based-view virgin to a wise head: **you have been so helpful** thank you On 4/17/20 1:08 PM, Dylan Reinhold wrote: def get_context_data(self, **kwargs):         # Call the base implementation first to get a context         context = super().g

Re: Capture URL values in a CBV

2020-04-17 Thread Dylan Reinhold
Tim you want to use get_context_data to add more data into your context for the template def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super().get_context_data(**kwargs) # You your stuff context['my_pk'] =

Re: Capture URL values in a CBV

2020-04-17 Thread Tim Johnson
OK. I am abandoning all pretext at self-sufficiency here. I have researched this for days, reviewed the links below and I still cannot resolve this issue. Maybe someone besides Gavin has an idea of how to capture the pattern between angle brackets in a url conf into a class-based view. I am

Re: Capture URL values in a CBV

2020-04-16 Thread Tim Johnson
On 4/15/20 7:24 PM, Gavin Wiener wrote: Hey Tim Hello Gavin: Thank you for your prompt reply. The bigger question is, what are you trying to achieve? I gotta know. I'm a retired programmer with 19 years doing CGI. Wrote and implemented my own framework. First in C, than C++ then rebol, the

Re: Capture URL values in a CBV

2020-04-16 Thread Gavin Wiener
Hey Tim The bigger question is, what are you trying to achieve? With the DetailView, fetching the object with the primary key is already handled for you, as you've seen the object will already be available in the template. This website is very useful to know which functions are implemented in

Capture URL values in a CBV

2020-04-15 Thread Tim Johnson
using django.VERSION (2, 1, 5, 'final', 0) with python 3.7.2 on ubuntu 16.04 Given the URL pattern below: path('', ArticleDetailView.as_view(), name='article_detail'), And the view as below: class ArticleDetailView(DetailView):     model = Article     template_name = 'article_detail.html'