0

I have some flatpages and I need to display it's content in a separate view.

What I am doing right now is to get those flatpages by url in the actual view using something like:

{% load flatpages %}
{% get_flatpages '/about/' as about_pages %}

Following the documentation I found in https://docs.djangoproject.com/en/1.9/ref/contrib/flatpages/

I would like to get those flatpages in my views.py and pass them as variables to whatever view I want.

Any idea about how to accomplish this?

carlosbvz
  • 163
  • 2
  • 14

1 Answers1

1

Flatpages are just models, like anything else; you can query them and pass the instances around however you like.

from django.contrib.flatpages.models import FlatPage
flatpage = FlatPage.objects.get(url='/about/)
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895