Access to field in extended flatpage in django
        Posted  
        
            by 
                Stanislav Feldman
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Stanislav Feldman
        
        
        
        Published on 2010-12-22T09:26:46Z
        Indexed on 
            2010/12/22
            9:54 UTC
        
        
        Read the original article
        Hit count: 295
        
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?
© Stack Overflow or respective owner