Awesome Josh!  Thanks so much!  I got it working!

In case someone else stumbles across this I also had to make sure that the
directory containing my new app was in the Python sys.path()  (I added it
in the wsgi file).  Since that directory is my Mezz directory I figured
that everything would work - but I was wrong.

Thanks again!

Derek



On Fri, Mar 7, 2014 at 2:36 PM, Josh Cartmell <[email protected]> wrote:

> Hey Derek, take a look at the Code Layout here,
> https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#code-layout
>
> Basically you need to create a new Django app (python manage.py startapp
> app_name), add it to your INSTALLED_APPS, create a templatetags directory
> inside of the new app (don't forget to put an empty __init__.py inside the
> templatetags directory) and then create a file called library_name.py in
> that new directory (replace library_name with whatever suits you).
>
>
> On Fri, Mar 7, 2014 at 10:47 AM, Derek Gaston <[email protected]> wrote:
>
>> Thanks Josh!
>>
>> A template tag looks perfect - and I'm already using that blog tag for
>> creating a side block with blog posts in it so I can easily see how to do
>> that.
>>
>> Now: Where do I put the template tag?  All I have is a Mezzanine project
>> - what file/directory do I need to create to put this template tag code -
>> and how do I register it with Mezz?
>>
>> Thanks for the help!
>>
>> Derek
>>
>>
>> On Friday, March 7, 2014 11:22:33 AM UTC-7, Josh Cartmell wrote:
>>
>>> Hey Derek, a page processor could work, although they get registered to
>>> a particular page type or slug so it wouldn't run on *all* pages.  I'm not
>>> sure what you meant about a "huge warning about not working with newer
>>> versions of Mezz", they definitely do work in the latest Mezzanine.
>>>
>>> Another solution could be to write a custom template tag.  For example,
>>> blog_recent_posts adds a list of recent posts to the template context.
>>> Here is the python code https://github.com/stephenmcd/
>>> mezzanine/blob/master/mezzanine/blog/templatetags/blog_tags.py#L54 and
>>> here's an example of using it in a template,
>>> https://github.com/stephenmcd/mezzanine/blob/master/
>>> mezzanine/blog/templates/blog/includes/filter_panel.html#L4
>>>
>>> You could also use a template context processor to add stuff to the
>>> template context on every request, https://docs.djangoproject.
>>> com/en/dev/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORS
>>>
>>> One or more of these solutions should get you what you want =)
>>>
>>>
>>> On Fri, Mar 7, 2014 at 10:04 AM, Derek Gaston <[email protected]> wrote:
>>>
>>>> That does seem to be close to what I'm looking for - but it has a huge
>>>> warning about not working with newer versions of Mezz... so it's probably a
>>>> non-starter
>>>>
>>>> I actually don't need anything very sophisticated - I can do all the
>>>> HTML/template wrangling to create the block myself.  I just need to execute
>>>> some custom python and send the results to the template (which I'm pretty
>>>> sure is what a "Page Processor" is for)... now i just need to figure out
>>>> where to put such a thing.
>>>>
>>>> Thanks for the reply!
>>>>
>>>> Derek
>>>>
>>>>
>>>> On Friday, March 7, 2014 10:53:49 AM UTC-7, Tom Brander wrote:
>>>>>
>>>>> Checkout the third party modlules at the bottom of this page
>>>>> http://mezzanine.jupo.org/docs/overview.html?highlight=third%20partySomething
>>>>>  like
>>>>> mezzyblocks <https://github.com/jardaroh/mezzyblocks>  may be what
>>>>> you are after...
>>>>>
>>>>>
>>>>> On Friday, March 7, 2014 11:35:57 AM UTC-6, Derek Gaston wrote:
>>>>>>
>>>>>> I'm definitely new to the Django/Mezz world... but I've built some
>>>>>> fairly complex and interesting things with Flask so I'm not completely
>>>>>> clueless.  Actually, my Flask background may be hurting me as it seems to
>>>>>> have an almost inverse model to Django (Flask is more "event" driven 
>>>>>> where
>>>>>> it feels like Django is more "data" driven).
>>>>>>
>>>>>> That said - I am currently absolutely stumped.  "All" I want to do is
>>>>>> run some custom python and display the results in a box in the right
>>>>>> sidebar (on every page).  I don't need any new Models or data or anything
>>>>>> (the data is going to come from elsewhere on the same server).  Just a 
>>>>>> hook
>>>>>> to run some python and present the results to the page template.
>>>>>>
>>>>>> Any clues on where to start?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Derek
>>>>>>
>>>>>  --
>>>> 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.
>>
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Mezzanine Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mezzanine-users/w0aqUq3vjBs/unsubscribe.
> To unsubscribe from this group and all its topics, 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