Re: Help with implementing dynamic views/models

2011-10-11 Thread Laura C.
BEAUTIFUL! It's printing the HTML as a string, though, but that I can putz around with, at least I have output! Thank you *so* much, Brett!! On Tue, Oct 11, 2011 at 12:49 PM, Brett Epps wrote: > The reason for that output is that page is a list, not a single object. > If you want a specific pag

Re: Help with implementing dynamic views/models

2011-10-11 Thread Brett Epps
The reason for that output is that page is a list, not a single object. If you want a specific page, use Page.objects.get instead of Page.objects.filter. Brett On 10/11/11 11:30 AM, "Laura C." wrote: >that at least gave me an output, but the output is: [] > >I have a potential to need 3 attrib

Re: Help with implementing dynamic views/models

2011-10-11 Thread Laura C.
that at least gave me an output, but the output is: [] I have a potential to need 3 attributes from each object in each template, so the mapping may not be what I need. If I pass in a context object, I thought that I should have handles for object.attribute ?  Or maybe I need to map the dict befor

Re: Help with implementing dynamic views/models

2011-10-11 Thread Brett Epps
Try it with {'page': page} as your extra_context. The keys in a context dict should always be strings. Brett On 10/11/11 8:29 AM, "xenses" wrote: >I thank you for your help and apologize for my naivete, however I >still am not seeing that tag populate in the template. Here is my view >function

Re: Help with implementing dynamic views/models

2011-10-11 Thread xenses
I thank you for your help and apologize for my naivete, however I still am not seeing that tag populate in the template. Here is my view function in its entirety: def test(request, testn): try: testn = str(testn) page = Page.objects.filter(name = "test%s" % testn) retu

Re: Help with implementing dynamic views/models

2011-10-10 Thread Brett Epps
The direct_to_template() function can take an extra_context keyword argument (a dict). So: direct_to_template(request, template='blah.html', extra_context={'foo': bar}) Would let you use {{ foo }} in a template to output the value of the variable bar. By the way, as a replacement for direct_to_t

Re: Help with implementing dynamic views/models

2011-10-10 Thread xenses
That is exactly what I want to do, I can't seem to understand exactly how to implement that and have it populate in the template. Do I just define the variable in the views and then in the template use {{ variable_name }} where I need it? Because I tried that first and it didn't work. So, maybe I'm

Re: Help with implementing dynamic views/models

2011-10-10 Thread Brett Epps
I may be misunderstanding your question, but it sounds like you need to use Page.objects.get or Page.objects.filter (in your view function) to look up the particular objects that you want to send to the template. Brett On 10/10/11 9:53 AM, "xenses" wrote: >This may seem like a very simple ques

Help with implementing dynamic views/models

2011-10-10 Thread xenses
This may seem like a very simple question and I have just missed the answer in the piles of documentation and tutorials that I've read over the past two days. I'm new to Django and trying to implement an internal site at work, and I'm the only Python/Django person we have, so this is all on me. Wh