Re: Adding more data to Generic Views

2012-08-02 Thread Melvyn Sopacua
On 31-7-2012 22:45, Lachlan Musicman wrote: > Yes, I was doing that originally (when there was no Compensation objects), > but I was struggling with only rendering when a set existed - for example, > in my person_detail.html I was rendering from the wrong direction - via the > non-Person object vi

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Wed, Aug 1, 2012 at 8:45 AM, Lachlan Musicman wrote: > On Wed, Aug 1, 2012 at 12:43 AM, Melvyn Sopacua wrote: > >> On 31-7-2012 6:17, Lachlan Musicman wrote: >> >> > I have Person, Certificate, Job and Compensation objects. The last three >> > all >> > have an FK (or M2M) back to a (or some) P

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Wed, Aug 1, 2012 at 12:43 AM, Melvyn Sopacua wrote: > On 31-7-2012 6:17, Lachlan Musicman wrote: > > > I have Person, Certificate, Job and Compensation objects. The last three > > all > > have an FK (or M2M) back to a (or some) Person(s). > > > > So reverse relations. > Yep, thanks - with Djan

Re: Adding more data to Generic Views

2012-07-31 Thread Lachlan Musicman
On Tue, Jul 31, 2012 at 11:15 PM, Karl Sutt wrote: > So, in conclusion, Lachlan, you would want to do something like: > > def get_context_data(self,**kwargs): >> #Call the base implementation first to get a context >> context = super(PersonDetailView, self).get_context_data(**kwa

Re: Adding more data to Generic Views

2012-07-31 Thread Melvyn Sopacua
On 31-7-2012 6:17, Lachlan Musicman wrote: > I have Person, Certificate, Job and Compensation objects. The last three > all > have an FK (or M2M) back to a (or some) Person(s). > So reverse relations. > def get_context_data(self,**kwargs): > #Call the base implementation first to ge

Re: Adding more data to Generic Views

2012-07-31 Thread Karl Sutt
So, in conclusion, Lachlan, you would want to do something like: def get_context_data(self,**kwargs): > #Call the base implementation first to get a context > context = super(PersonDetailView, self).get_context_data(**kwargs) > #Add in a querysets > context['job_li

Re: Adding more data to Generic Views

2012-07-31 Thread Per-Olof Åstrand
Hi, I just started to convert my small hobby-project into class-based views and struggled with similar things (but with a ListView instead). The person object is in the context dictionary, so you need to refer to it by context['person']. More generally, it is instructive to print context, kwar

Adding more data to Generic Views

2012-07-30 Thread Lachlan Musicman
Hola, I'm confused about adding extra content to a class based Generic View. I've read the docs at file:///home/datakid/src/django-docs/topics/class-based-views.html and have written the code accordingly. I have Person, Certificate, Job and Compensation objects. The last three all have an FK (or