On Wednesday 24 May 2017 09:38:08 jorge alarcon wrote:

> where as my current view is:
> 
> class IndexView(generic.ListView):
> 
>     template_name = "db/index.html"
> 
>     paginate_by = 50
> 
>     context_object_name = 'Columns'
> 
>     queryset = Columns.objects.all()
> 
> 
> However, this gives me entries that end up looking like this:
> 
>             [name]                                [Dataset]
>      [Columnnames ]
> Ave_rent_1_bedroom       Datasets object          Columnnames object
> ....
> 
> Is there a way of spaning the relationship between `Columns` and
> `Columnnames` so that Columns.objects.all() outputs the actual entry
> for the [Columnnames ] field instead of just "Columnnames object"?

You can drill down quite far in your template. This isn't a view problem, but 
even then, you 
can override get_context_data if want to provide a cleaner context for your 
template.

What happens now is that you use {{ instance }} in your template and that 
coerces instance 
into it's string representation. But you're free to use {{ 
instance.columname.name }}.

-- 
Melvyn Sopacua

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2049594.b9X7zvvFhp%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to