On Jan 15, 2009, at 2:42 AM, Bradley wrote:

>
> I'm new to Django and I'm trying to modify an existing django website
> for a local newspaper.  They would like to have a polls on the their
> website.  I just used the tutorial from the djangoproject website to
> create the polls module.  It works fine, except that I need it to work
> inside a <div> section on the front page, not multiple pages like is
> used in the tutorial.  What is the standard procedure for something
> like this?
>
> The tutorial had me create entries for /polls/ in urls.py  I probably
> don't need those.
> Do I somehow Integrate the polls function into already existing
> function that are used to display the front page?  Not really sure how
> to proceed

If I'm understanding this correctly, you might want to look at  
template tags:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#howto-custom-template-tags

This would allow you to make calls to the database to retrieve  
whatever poll and related answers you want, render them as a stand- 
alone chunk of html, and then insert that html into an existing  
template. You could put it into the template as:

<div id="poll">
  {% get_poll_question some_poll %}
</div>

Where 'some_poll' was a variable that originates in your view.

Hope that helps,
Eric


>
> Any help would be appreciated.
>
> Thanks,
> Brad
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to