I'm trying to customise a CMS written in Django. The content editors aren't flexible enough so I'm trying to come up with a better solution.
Without over-explaining it, I'd like it to be a bit like django-better-chunks or django-flatblocks. You set up an editable region entirely from within the template. I want to bind these editable re...
[I have this discussion at http://groups.google.com/group/django-users/browse_thread/thread/989c569d5118980d]
Is 'django.template.loaders.app_directories.load_template_source'
required in the TEMPLATE_LOADERS setting for custom template tags to
work?
We know that simply having a custom tag in the templatetags directory of your Django ...
How on earth do people debug Django templatetags?
I created one, based on a working example, my new tag looks the same to me as the existing one. But I just get a
'my_lib' is not a valid tag library: Could not load template library from django.templatetags.my_lib, No module named my_lib
I know that this is probably because of someth...
I'm adding a set of template tags to a Django application and I'm not sure how to test them. I've used them in my templates and they seem to be working but I was looking for something more formal. The main logic is done in the models/model managers and has been tested. The tags simply retrieve data and store it in a context variable ...
Hello,
Edit : is there a way to easily convert {{ value|date:"Z" }} to one of the +hh:mm or -hh:mm formats (because date:"Z" returns xxxx or -xxxx seconds).
Show this for more explanations about the needed format.
Thank you and sorry for my ugly english. ;)
...
I've seen how I can write template tags that set a context variable based on a template like this
{% my_template_tag 'blah' as my_context_variable %}
But I'd like to be able to do this:
given that both group and user are set in the context in the view
{% is_in_group group user as is_member %}
{% if is_member %}
#.... do stuff ....
Wondering what is causing this? Had me stumped for some time, everything checks out in console when running in pieces
as a side note:
the template is using the same object in other places and displaying values - the object in template is also the same one loaded in the console below
error
'NoneType' object has no attribute 'source'...
Im getting strangest error in django so far:
'if' statement improperly formatted
Template that raises the error is this:
{% if diff >= 0 %}
<span class="pos">+{{ diff }}
{% else %}
<span class="neg">-{{ diff }}
{% endif %}
</span>
<span>{{ a }}</span>
view that has a and diff in context is this:
def add(request, kaart_id):
if ...
Hello
How can I achieve this using the Django template system:
Say I have 2 variable passed to the template system:
days=[1,2,3,4,5]
items=[ {name:"apple,day:3},{name:"orange,day:5} ]
I want to have such output as a table:
1 2 3 4 5
apple n n y n n
orange n n n n y
As you can notice, gi...
Django-compress is great, but it doesn't offer any tags for compressing in-page javascript.
Are there some solutions out there? Even removing newlines (and adding ";" where needed) would be just great.
...
Hello
I could not understand why after logging in from address:
http://localhost/en/accounts/login/?next=/en/test/
I get refirected to
http://localhost/accounts/profile/
So i ran search in django files and found that this address is the default LOGIN_REDIRECT_URL for django.
What i did not understand is why it gets redirected to...
I ran into an interesting "oversight" in the Django {% cycle %} template tag. This has been listed as a bug, but I'm wondering if there is a workaround for it?
{% for r1 in range_0_2 %}
{% for r2 in range_0_3 %}
{{ r1 }}-{{ r2 }}-{{ cycle 'even' 'odd' }}
{% endfor %}
{% endfor %}
This yields:
0-0-even
0-1-odd
0-2-even
1-0-odd...
HI,
I am writing a bunch of template tags for a Django application, that need a certain javascript library.
Each of those template tags could exist multiple times on the same Template.
I was wondering if there is a smart way that I could add the Javscript library in the templatetag templates?
Here is an example TemplateTagA uses cust...
When using the register.inclusion_tag() shortcut on a Custom Template Tag, assuming you define the template as 'some_fragment.html', in what directories/order does Django try to find that template?
Assume as many 'defaults' as is reasonable.
The Custom Template Tag portion of the documentation doesn't list anything specific, except t...
In this excellent Google Tech Talk by Jacob Kaplan-Moss, Jacob says that they added support for the include template tag despite previous dogmatic objections, and says that people shouldn't use it.
Does anyone know why? A quick search didn't show anything that would explain why. There's nothing relevant in the now-fixed ticket where sup...
Hello world!
Im trieng to build my own template tags
Im have no idea why I get the errors I get, im following the django doc's.
this is my file structure of my app:
pollquiz/
__init__.py
show_pollquiz.html
showpollquiz.py
This is showpollquiz.py:
from django import template
from pollquiz.models import PollQuiz, Choice
r...
Is this possible in any way?
My project folder structure looks like this:
my_project:
app1:
templatetags:
my_tags1.py (contains simple tags and inclusion tags)
app2:
templatetags:
my_tags2.py (contains some simple tags)
templates:
app1: index.html
app2: index.html
The...
Hi,
in my Django 1.1.1 application I've got a function in the view that returns to his template a range of numbers and a list of lists of items, for example:
...
data=[[item1 , item2, item3], [item4, item5, item6], [item7, item8, item9]]
return render_to_response('page.html', {'data':data, 'cycle':range(0,len(data)-1])
Inside the...
All,
How Can we increment a value like the following in django templates,
{{ flag =0 }}
{% for op in options %}
{{op.choices}}<input type="radio" name="template" id="template" value="template{{flag++}}"/>
{% endfor %}
thanks..
...