Thank you very much, Stephen -- I thought I'd tried this and found it not
to work but on second attempt in fact it does! Sorry to waste your time,
Christian

On 14 August 2015 at 11:14, Stephen McDonald <[email protected]> wrote:

> Try page.get_content_model.foo
>
> On Fri, Aug 14, 2015 at 8:12 PM, Christian Hill <[email protected]> wrote:
>
>> Dear mezzanine-users,
>> I've got a problem that I think stems from my not fully understanding
>> Mezzanine's Page inheritance.
>> I have some models:
>>
>> class Resource(models.Model):
>>     foo = models.IntegerField()
>>
>> class APage(Page, RichText, Resource):
>>     # ... some fields
>>
>> class BPage(Page, Resource):
>>     # ... some different fields
>>
>> In my customized menu page, I'd like APages and BPages to be listed along
>> with their foos (which attributes they have by virtue of their
>> inheritance from Resource). But:
>>
>> <a href="{{ page.get_absolute_url }}">{{ page.foo }} {{ page.title }}</a>
>>
>> doesn't work because I need to refer to a specific page model, e.g. this
>> works:
>>
>> <a href="{{ page.get_absolute_url }}">{{ page.apage.foo }} {{ page.title
>> }}</a>
>>
>> but only for the APage instances. When looping over the pages in the menu
>> template, some will be APages and some BPages. How can I tell the template
>> to look for the page's foo attribute whether that page is an APage or a
>> BPage?
>>
>> Thanks for any help you can give,
>> Christian
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Stephen McDonald
> http://jupo.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to