Chris, Eduardo,
Having read your emails, I kept thinking about this and I realized that
another not-so-complicated solution may be adding a boolean field to the
page model:
(
"mezzanine.pages.models.RichTextPage.show_login",
"BooleanField",
(u"Show Login",),
{"default": False},
),
Then you should add the field to the admin (unregister the page admin, copy
the fieldsets, add the field and re-register the admin - there are examples
with adding fields to the Product Admin).
And there you check in the template for the variable
On Wed, May 4, 2016 at 2:29 PM, Christian Hill <[email protected]> wrote:
> Thanks, Eduardo -- I get the sense from the documentation you refer to
> that this technique only works on page models that are subclassed from Page
> itself, as Author is in that example.
>
> Rodrigo is recommending this approach, so I guess I'll do it, but it seems
> a little odd to me that I need to create a whole new page model (with
> identical fields) simply to tweak the base template a little bit -- for one
> thing, I have several pages that are currently RichTextPages and will have
> to be converted to FooRichTextPages and for another, it's going to add to a
> growing list of models to administer down the left hand side of my admin
> page.
>
> Thank you for taking the time to reply,
> Best wishes,
> Chris
>
> On 4 May 2016 at 18:12, Eduardo Rivas <[email protected]> wrote:
>
>> From the docs I get the idea that hierarchy-based templates should be
>> working. Have you tried this?
>> http://mezzanine.jupo.org/docs/content-architecture.html#page-templates
>> You may have found a bug if it doesn't work that way.
>>
>> Assuming that doesn't work, here are other options for your consideration:
>>
>> Option1: Create a template tag that optionally renders the snippet you
>> want based on the slug of the current page, use it in base.html so it's
>> always available. You can store all slugs that should show the login block
>> in a setting, and have the tag read that.
>>
>> Option 2: Create a page processor for all pages that checks the slug and
>> injects a context variable to let you decide in-template if you should
>> render the block.
>>
>>
>> --
>> 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.
>>
>
>
>
> --
> Learning Scientific Programming with Python
> scipython.com: | @scipython3 <https://twitter.com/scipython3>
>
>
> --
> 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.