Access to field in extended flatpage in django
- by Stanislav Feldman
How to access field in extended flatpage in django?
I wrote this:
class ExtendedFlatPage(FlatPage):
teaser = CharField(max_length=150)
class ExtendedFlatPageForm(FlatpageForm):
teaser = CharField(max_length=150)
class Meta:
model = ExtendedFlatPage
class ExtendedFlatPageAdmin(FlatPageAdmin):
form = ExtendedFlatPageForm
fieldsets = (
(None, {'fields': ('url', 'title', 'teaser', 'content', 'sites',)}),
)
admin.site.unregister(FlatPage)
admin.site.register(ExtendedFlatPage, ExtendedFlatPageAdmin)
And creation in admin is ok. But then in flatpages/default.html I tried this:
<html>
<body>
<h1>{{ flatpage.title }}</h1>
<strong>{{ flatpage.teaser }}</strong>
<p>{{ flatpage.content }}</p>
</body>
</html>
And there was no flatpage.teaser! What is wrong?