In the following code, i have a drop down box and a multi select box.
My question is that using javascript and django .how will i changes the designation with changes in names from drop down box.
<tr><td>
name:</td><td><select id="name" name="name">{% for name in names %}
<option value="{{name.id}}" {% for selec...
Hello,
I want to modify / change the way the floatformat works.
By default it changes the input decimal as such:
{{ 1.00|floatformat }} -> 1
{{ 1.50|floatformat }} -> 1.5
{{ 1.53|floatformat }} -> 1.53
I want to change this abit as such: If there is a floating part, it should keep the first 2 floating digits. If no floating (which me...
If there are are no values in the table how can should the code be to indicate no name found else show the drop down box in the below code
{% for name in dict.names %}
<option value="{{name.id}}" {% for selected_id in selected_name %}{% ifequal name.id selected_id %} {{ selected }} {% endifequal %} {% endfor %}>{{name.firstname}}</o...
I just installed django-compress into /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/compress.
I added 'compress' to INSTALLED_APPS.
In my template file, I wrote {% load compressed %}. I got the error:
'compressed' is not a valid tag
library: Could not load template
library from
django.templat...
When particularly extend template and when to use include ? Is include of any use with content like user profile section (like about me in the corner of our site) ?
...
I am trying to write a set of template tags that allow you to easily specify js and css files from within the template files themselves. Something along the lines of {% requires global.css %}, and later in the request, {% get_required_css %}.
I have this mostly working, but there are a couple of issues. We'll start with the 'timing' i...
According to this section in the Django docs I should use {% blocktrans %} for cases where I need to translate pluralizations. However, with an example like the following, isn't there something more convenient I can do?
{% blocktrans count video.views.count as views %}
The video has been viewed <span>{{ views }}</span> time
{% plural %}...
I have gone through the (painful) process of writing a custom template tag for use in Django. It is registered as an inclusion_tag so that it renders a template. However, this tag breaks as soon as I try to change something.
I've tried changing the number of parameters and correspondingly changing the parameters when it's called. It's c...
Hi All,
What I'd like to do (for a recent changes 'widget' - not a django widget in this case) is pass a urlname into my template as a variable, then use it like so: {% url sitechangeobject.urlname %} Where urlname is a string containing a valid name for a url.
Is this possible? The template keeps breaking saying it can't find sitechan...
I have a project in production. Everthing was working fun, but suddenly, I'm getting an error:
Caught NoReverseMatch while rendering: Reverse for 'forum.views.tag' with arguments '(u'',)' and keyword arguments '{}' not found.
I believe this is being called by this line from the template:
href="{% url forum.views.tag tag|urlencode ...
Is there a way to get the current page URL and all its parameters in a Django template?
For example, a templatetag that would print full URL like /foo/bar?param=1&baz=2
...
from django.utils.simplejson import dumps, loads
# -*- coding: utf-8 -*-
def index(request):
return render_to_response('test2/index.html')
def add_lang(request):
logging.debug("Got request")
a = request.POST
logging.debug(a["lang"])
lang=dumps(a["lang"])
l = Language(code=lang)
l.save()
lang=loads(lang)
lo...
I feel like I am writing something that should already exist.
Does Django have a template filter that joins a list of items on commas and places and 'and' before the last one?
For example:
a = ['foo',]
b = ['bar', 'baz',]
c = a + b
d = c + ['yourmom',]
The filter I am looking for would display each list in the following ways:
a...
I need to write a simple Django template tag that will display the user's IP Address?
...
I am nearing the final stages of a project and have run into a bit of a hiccup with Django.
It relates to the {% blocktrans %} tag.
How do I enable it to be fully functional in my app, currently if I wrap a piece of text in {% blocktrans %} I get a TemplateSyntaxError message
I have the following in my
TEMPLATE_CONTEXT_PROCESSORS = ...
I've been trying to add the django-lean app to my project.
I have not been able to get the tests to pass. It took me a few days with a debugger to determine what the problem was.
It seems that all the URL template tags fail in Test mode, but not in Production nor Developement.
Failure happens in django.template.defaulttags.URLNode.ren...
My site is quite visual and I would like to make use of users avatars all over the site so I think that writing a custom template tag is the best way to go.
My UserProfile is associated with a User and has an profile_pic.
I am making use of django-imagekit and hence the ImageModel comes into play
class UserProfile(ImageModel):
p...
I'm filtering out results from my page_obj in a generic view to only show entries published in the same language as the languge currently set by django-cms (http://www.django-cms.org/en/documentation/2.0/i18n/).
This works fine, but adding in support for Django pagination (http://docs.djangoproject.com/en/1.2/topics/pagination/) causes ...
I have the following inclusion tag:
@register.inclusion_tag('bouts/fighter/_fighter_bout_list.html')
def fighter_bout_list(list, header, fighter, has, empty):
return {
'list' : list,
'header': header,
'fighter': fighter,
'has' : has,
'empty' : empty,
}
To use it, I ca...
<script>
function compare(profile_id)
{
{% ifequal '{{profile.id}}' %}
selected_sub='selected';
{% endifequal %}
}
</script>
How to compare {{profile.id}} and javascript variable profile_id
...