List Info

Thread: How to populate flatpage content dynamically?




How to populate flatpage content dynamically?
user name
2007-12-28 10:51:40
Hi folks,

As a start, I created a flatpage in the admin interface, and
pointed
it at a template that looks like this:

{% extends "base.html" %}
{% block content %}
<h2>{{ flatpage.title }}</h2>
{{ flatpage.content }}
{% endblock %}

Okay, this is excellent - it displays the flatpage content
from the
database, within the context of the main page, using the
same style as
the base template. This is good.

Now, I want to take the next step - generate
flatpage.content
dynamically so that I can show my Trac webpages within my
context.
According to the flatpage documentation, this can be done
via the API.

I'd like to know - what is the best practice to approach
this? Judging
by the Django website's source code, flatpages app is used
to display
the Django Trac pages within the context of the main page -
by
injecting the Trac content and {% extrahead %} inline CSS to
make it
work. Am I right? I'd like to follow this example. I am a
little lost
as to what models/views to create, because I don't see any
such Django
Trac-related objects in the source code.

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


Re: How to populate flatpage content dynamically?
country flaguser name
United States
2007-12-30 14:06:17
Basilisk96 wrote:
> Now, I want to take the next step - generate
flatpage.content
> dynamically so that I can show my Trac webpages within
my context.
> According to the flatpage documentation, this can be
done via the API.
>
> I'd like to know - what is the best practice to
approach this?

My vote would be to write a custom view that extends the
flatpage view.
You could then make the flatpage.content whatever you want.

Another option would be to put the name of the trac page
into the
flatpage content, and then write a custom template filter
that would
look up the trac page by name, and insert the data into the
page.

Choose your poison

Cheers!

Jeff Anderson

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )