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 » Truncating & {form}

First of all, SCT is one of the most useful and best documented pre-applications I've seen so far. :)
After the setup I found some things that I'd like to change, but don't know how:

1. I'd like to truncate the thread.subject. In order to do this, I found this line in the latest_posts template file:

{% sph_truncate latestPost.subject 30 "..." %}.

What would I need to do in order to assign this to the thread.subject?

2. There is a {{ form }} in the displayPostForm.html file, whose template structure I'd like to change. Where does it lead to?


Thanks in advance, I appreciate your work on this project!

Moritz
unknown unknown said @ 2009-10-29 15:42:16:
{% sph_truncate latestPost.subject 30 "..." %}.

What would I need to do in order to assign this to the thread.subject?
have you tried {% sph_truncate thread.subject 30 "..." %} ? :) maybe you need to {% load sph_extras %} if it is not done already.

unknown unknown said @ 2009-10-29 15:42:16:
2. There is a {{ form }} in the displayPostForm.html file, whose template structure I'd like to change. Where does it lead to?


the form is done with the django form framework. please check the forms documentation of django: http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template.
Hey, we have Signatures !!! Great, isn't it ? ;)
Great! Thanks for the support - I'll try and do this asap! Although I've got a major issue at the moment for which I'll have to create a new topic here in the forums. :(

Moritz
Alright, I got this working now. The next thing I want to alter are the breadcrumbs in the forums. I'd like to display them in the communitydraft/.../sitetemplates/base_root.html. Is that possible? I tried loading sph extras and sph board extras, but this caused an unhandled exeption.

thanks in advance!

--- Last Edited by Moritz Giller at 2009-11-10 20:15:48 ---
can you please provide the stacktrace and message of the exception? thanks :)
Hey, we have Signatures !!! Great, isn't it ? ;)
Traceback (most recent call last):

File "/home/enlyra/django-active/django/core/handlers/base.py", line 92, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/home/enlyra/active/communitydraft/community/../../communitytools/sphenecoll/sphene/sphwiki/views.py", line 75, in showSnip
context_instance = RequestContext(request) )

File "/home/enlyra/django-active/django/shortcuts/__init__.py", line 20, in render_to_response
return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)

File "/home/enlyra/django-active/django/template/loader.py", line 108, in render_to_string
return t.render(context_instance)

File "/home/enlyra/django-active/django/template/__init__.py", line 178, in render
return self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/loader_tags.py", line 97, in render
return compiled_parent.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 178, in render
return self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/loader_tags.py", line 97, in render
return compiled_parent.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 178, in render
return self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/loader_tags.py", line 97, in render
return compiled_parent.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 178, in render
return self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/loader_tags.py", line 97, in render
return compiled_parent.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 178, in render
return self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/loader_tags.py", line 24, in render
result = self.nodelist.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 779, in render
bits.append(self.render_node(node, context))

File "/home/enlyra/django-active/django/template/__init__.py", line 792, in render_node
return node.render(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 930, in render
resolved_vars = [var.resolve(context) for var in self.vars_to_resolve]

File "/home/enlyra/django-active/django/template/__init__.py", line 687, in resolve
value = self._resolve_lookup(context)

File "/home/enlyra/django-active/django/template/__init__.py", line 740, in _resolve_lookup
raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute

VariableDoesNotExist: Failed lookup for key category in u'[{\'block\': <Block Node: body. Contents: [<Text Node: \'\n<div class="page-wrapper\'>, <If node>, <Text Node: \'\n \n \t\n \'>, <django.template.InclusionNode object at 0x9cfc96c>, <Text Node: \'\n </div>\n <h1 class\'>, <If node>, <Text Node: \'\n </h1>\n </div> \n\n\'>, <Block Node: precontent. Contents: [<Text Node: \'\n \n \'>]>, <Text Node: \'\n <div id="content">\n\'>, <If node>, <Text Node: \'\n\'>, <Block Node: content. Contents: [<Text Node: \'\n \'>, <django.template.loader_tags.ConstantIncludeNode object at 0x9cee68c>, <Text Node: \'\n \'>, <If node>, <Text Node: \'\n \'>, <If node>, <Text Node: \'\n\'>]>, <Text Node: \'\n</div>\n\'>]>}, {\'snip\': <WikiSnip: Start (example)>, \'redirects\': (), \'commentstemplate\': \'sphene/sphwiki/wikicomments_unavailable.html\', \'snipName\': u\'Start\', \'snip_rendered_body\': u\'\\n<p>weird. weird. amazing. weird. haha!\\n</p>\\n\\n\\n\'}, {\'group\': <Group: example>, \'navigation_top\': [], \'urlPrefix\': \'\', \'sph\': {\'subtitle\': u\'Testing stuff!\', \'group_fromhost\': True, \'current_url\': u\'/wiki/show/Start/\', \'installed_apps\': [\'django.contrib.auth\', \'django.contrib.contenttypes\', \'django.contrib.sessions\', \'django.contrib.sites\', \'django.contrib.humanize\', \'django.contrib.flatpages\', \'django.contrib.admin\', \'django.contrib.sitemaps\', \'sphene.community\', \'sphene.sphboard\', \'sphene.sphwiki\', \'sphene.sphblog\']}, \'sph_settings\': <sphene.community.sphutils.SphSettings object at 0x9ceec2c>, \'navigation_left\': [<Navigation: Wiki>, <Navigation: Board>, <Navigation: Blog>], \'sph_perms\': <sphene.community.context_processors.PermissionFlagLookup object at 0x9cee0cc>}, {\'MEDIA_URL\': \'/static/\'}, {\'request\': <WSGIRequest\nGET:<QueryDict: {}>,\nPOST:<QueryDict: {}>,\nCOOKIES:{\'__utma\': \'223283022.162863793.1255986136.1256857324.1257599684.23\',\n \'__utmz\': \'223283022.1255986136.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)\',\n \'sessionid\': \'4d4810fe1b180da2339e29ea1a6e5cfa\'},\nMETA:{\'DOCUMENT_ROOT\': \'/home/enlyra/public_html\',\n \'GATEWAY_INTERFACE\': \'CGI/1.1\',\n \'HTTP_ACCEPT\': \'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\',\n \'HTTP_ACCEPT_ENCODING\': \'gzip, deflate\',\n \'HTTP_ACCEPT_LANGUAGE\': \'en-us\',\n \'HTTP_COOKIE\': \'__utma=223283022.162863793.1255986136.1256857324.1257599684.23; __utmz=223283022.1255986136.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); sessionid=4d4810fe1b180da2339e29ea1a6e5cfa\',\n \'HTTP_HOST\': \'active.sites.djangoeurope.com\',\n \'HTTP_IF_MODIFIED_SINCE\': \'Sun, 25 Oct 2009 02:12:18 GMT\',\n \'HTTP_USER_AGENT\': \'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9\',\n \'HTTP_X_FORWARDED_FOR\': \'86.151.47.181\',\n \'HTTP_X_FORWARDED_PROTO\': \'http\',\n \'HTTP_X_HOST\': \'sites.djangoeurope.com\',\n \'PATH_INFO\': u\'/wiki/show/Start/\',\n \'PATH_TRANSLATED\': \'/home/enlyra/public_html/wiki/show/Start/\',\n \'QUERY_STRING\': \'\',\n \'REDIRECT_STATUS\': \'200\',\n \'REDIRECT_URI\': \'/django.fcgi/wiki/show/Start/\',\n \'REMOTE_ADDR\': \'86.151.47.181\',\n \'REMOTE_PORT\': \'0\',\n \'REQUEST_METHOD\': \'GET\',\n \'REQUEST_URI\': \'/wiki/show/Start/\',\n \'SCRIPT_FILENAME\': \'/home/enlyra/public_html/django.fcgi\',\n \'SCRIPT_NAME\': u\'\',\n \'SERVER_ADDR\': \'127.0.0.1\',\n \'SERVER_NAME\': \'active.sites.djangoeurope.com\',\n \'SERVER_PORT\': \'63541\',\n \'SERVER_PROTOCOL\': \'HTTP/1.0\',\n \'SERVER_SOFTWARE\': \'lighttpd/1.4.19\',\n \'wsgi.errors\': <flup.server.fcgi_base.TeeOutputStream object at 0x9ce9ecc>,\n \'wsgi.input\': <flup.server.fcgi_base.InputStream object at 0x9ce98cc>,\n \'wsgi.multiprocess\': True,\n \'wsgi.multithread\': False,\n \'wsgi.run_once\': False,\n \'wsgi.url_scheme\': \'http\',\n \'wsgi.version\': (1, 0)}>}, {\'LANGUAGES\': ((\'de\', \'German\'), (\'en\', \'English\'), (\'fr\', \'French\'), (\'pl\', \'Polish\'), (\'ko\', \'Korean\'), (\'ru\', \'Russian\')), \'LANGUAGE_BIDI\': False, \'LANGUAGE_CODE\': \'en\'}, {}, {\'perms\': <django.core.context_processors.PermWrapper object at 0x9ceec6c>, \'messages\': [], \'user\': <User: fanboi>}, {}]'

This should be it. I think the base_root.html needs and "if board" "else display none" statement. Otherwise it tries to pull the data from the board, but doesn't find any categories. Am I right?

--- Last Edited by Moritz Giller at 2009-11-11 19:42:51 ---

--- Last Edited by Moritz Giller at 2009-11-11 19:43:26 ---

Please login to post a reply.



Powered by Sphene Community Tools