Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Template Inclusion / Overriding

Page: 1 2 Next

I am very new to Django (still reading the book) but I am trying to set up a site using SCT (very nice work). With some poking and prodding I have managed to get things up and stable using the communityDraft as a base.

I can not figure out how the templates are getting pulled in. I am not getting the Django application templates (for the admin pages or any other Django service I try to access). And it seems that the templates for SCT are spread out all over the place. For example I do not want the Blogs to show up on the board page. So I went poking around to find that template which I think I finally got at in:

communitytools/sphenecoll/sphene/sphboard/templates/sphene/sphboard/_displayCategories.html


Which is mighty deep. Yet when I add that template path to my sitetemplates as in:

myproject/sitetemplates/sphene/sphboard/_displayCategories.html


it does not override the display.

I have tried mucking with the TEMPLATE_DIRS variable in the settings_local.py file. But when I do that Django crashes and will not start until I remove the TEMPLATE_DIRS override in that file. (Which seems weird to me..??)

So instead I altered it a bit in the main settings.py file to this:

import django

DJANGO_ROOT= os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(django.__file__)),'..'))

TEMPLATE_DIRS = (
    os.path.join(ROOT_PATH, 'sitetemplates'),
    os.path.join(DJANGO_ROOT,'contrib','admin','templates'),
    os.path.join(DJANGO_ROOT,'contrib','sitemaps','templates'),
    os.path.join(DJANGO_ROOT,'contrib','comments','templates'),
    os.path.join(DJANGO_ROOT,'contrib','databrowse','templates'),
    os.path.join(DJANGO_ROOT,'contrib','formtools','templates'),
)

And still I do not get any of the Django templates... Nor are there any error messages coming out stdout or stderr (which I find annoying, is there a way to turn on verbose or debugging output?)

Thanks in advance.
hi,

the main settings variable affecting template loading in django is
TEMPLATE_LOADERS - this defines the order of template loaders it should try ... and only the filesystem template loader will use TEMPLATE_DIRS (afaik)

SCT makes use of the 'app_directories' template loader to cleaely separate templates for all applications and so users don't require to set up the template directory for SCT manually..

anyhow .. unfortunately . this does not solve your problem, because in the default configuration the filesystem template loader is coming before the app_directories loader.. so if you put your template into 'sitetemplates' it should actually work.. are you sure that the directory is used ? do changes to other templates (e.g. base.html) affect the outcome ?


as for hiding the blog from the overview.. i recently extended the API for "category types" so they can tell to be hidden from the overview.. (i implemented it for the comments application)
since i guess it would make sense for blog categories to be hidden .. i have now added another category type extending 'sph blog': 'Blog Category hidden from forum overviews' - if you are using SCT from SVN trunk just update and change your blog category type to the new one .. and it should be hidden

Hey, we have Signatures !!! Great, isn't it ? ;)
Thanks a lot. I have been doing some more poking at the templates (since this is critical for me to do what I want) I need to be able to override simply by putting the correct template in place in the sitetemplates directory. Do you have anything like a template layout map for all the components of SCT? Source crawling is teaching me a lot about how it is all put together but is time consuming. It would be nice to have a layout guide so I could see how each component is built up, and consequently would be able to strategically override the right bit without breaking anything else.

I am using the SVN link so am trying to NOT have to change anything in SVN but override by extending or overlaying within the site project directory.

Thanks again for updating the blog category I'll go try that now.
Well I tried the svn update and changing the category type. Which caused the blog to disappear completely even from my /blog/ url. Which isn't exactly what I was after ;^)

Do I need to update the navigation type to something. I have looked through the admin area and even at the urls.py in the sphblog area and it isn't making a lot of sense. I actually had some content in there. SO I have reverted its type back for now.
sorry, i forgot to add the new category type to the filter which retrieves the blog categories.. try again :)


as for the templates.. i don't have any layout map or similar .. if you have any specific question about how to extend/modify SCT let me know ..
Hey, we have Signatures !!! Great, isn't it ? ;)
Seems you also missed the posting of the new articles too. I just went to post something and got a server error with a stack trace ending at

File "/srv/django/communitydraft/community/../../communitytools/sphenecoll/sphene/sphboard/views.py" in post
396. postForm = MyPostForm( )
Sorry missed a little bit:

TypeError at /board/post/4/
'NoneType' object is not callable
Request Method: 	GET
Request URL: 	http://www.nodsw.com/board/post/4/
Exception Type: 	TypeError
Exception Value: 	'NoneType' object is not callable
Exception Location: 	/srv/django/communitydraft/community/../../communitytools/sphenecoll/sphene/sphboard/views.py in post, line 396
Python Executable: 	/usr/bin/python
omg.. i extended the wrong class :-/

--- categorytypes.py    (revision 628)
+++ categorytypes.py    (working copy)
@@ -85,7 +85,7 @@
         return 'sphene/sphblog/show_blogentry.html'


-class HiddenBlogCategoryType(CategoryType):
+class HiddenBlogCategoryType(BlogCategoryType):
     name = "sphbloghidden"


Hey, we have Signatures !!! Great, isn't it ? ;)
LOL, Yep that would cause all kinds of headaches wouldn't it.

OK Well I'll give it another go.

(12:45 in the AM. You must be another night owl.)

BTW, I have my web development web site up and have the stated goals and features I am trying to get to. http://www.nodsw.com/
Well that fixed it. I was able to post to it as a hidden forum.

Thanks!!

Page: 1 2 Next

Please login to post a reply.



Powered by Sphene Community Tools