I have a Django radio button group that renders to HTML as follows:
<ul>
<li><label for="id_package_id_0"><input type="radio" id="id_package_id_0" value="1" name="package_id" /> Test 256</label></li>
<li><label for="id_package_id_1"><input type="radio" id="id_package_id_1" value="2" name="package_id" /> Test 384</label></li>
<li><label ...
I have this field in my Post model:
created = models.DateTimeField(_('created'), default=datetime.now)
In my template I have this:
{{ post.created|date:"SHORT_DATE_FORMAT" }}
I my settings.py I have this:
LANGUAGE_CODE = 'it'
USE_L10N = True
But I get this:
th03-0500RCDT_marAMCDTE_maggio-0500RMagAMCDT
Why ?
This is the docum...
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 have a simple Blog model with a TextField.
What is the best way to save links in the TextField ?
1) Saving link in the database in this form: http://www.example.com
and then using some filter in the template to trasform it in form:
<a rel="nofollow" href="http://www.example.com>http://www.example.com</a>
2) Saving link in...
I need to throw ValidationError containing anchor.
if not profile.activated():
raise ValidationError('Your profile is not activated. <a href="{% url resend_activation_key %}">Resend activation key</a>.')
What I need to modify to make this work?
...
Hello,
I have a model like this:
class Entity(models.Model):
entity_name = models.CharField(max_length=100)
entity_id = models.CharField(max_length=30, primary_key=True)
entity_parent = models.CharField(max_length=100, null=True)
photo_id = models.CharField(max_length=100, null=True)
username = models.CharField(m...
In my view I return all posts of one blog:
posts = Post.objects.filter(blog=blog)
and pass it to context.
But.. How can I get the number of posts in the template ?
This is my template:
<h1>Number of posts: {{ ??? }} </h1>
{% for post in posts %}
{{ post.title }}
{{ post.body }}
{% endfor %}
...
I have a site on which I'm including a userBox with some data shown for each logged user (your name, avatar etc). From what I already know about django it seems obvious, that I should add query for user to context processor (so that I can use {{user}} variable in this included userBox ). But while using django-lfs shop I've noticed, that...
Hi guys, i need to render my forms with the property "title" for jquery validation, how ill render my forms in this way?
<input name="name" id="name" title="Please fill Your name!" value="" type="text" />
Thanks guys
...
I am building a website where my pages are written in MediaWiki Markup, for which I have a working parser function in Python.
Where exactly do I parse my markup: in the view's code, or in the template? My first guess would be something like:
return render_to_response( 'blog/post.html', {'post': post,
'content...
hi people, I wanna make change in css class every 3 loops. In the first three I want to use the CSS class A, in the next three I want to use the CSS class B, in the next three I want to use the CSS class A again and so on.
can anyone help? Thanks
...
I have a many to many relationship in my models and i'm trying to reorganize it on one of my pages.
My site has videos. On each video's page i'm trying to list the actors that are in that video with links to each time they are in the video(the links will skip to that part of the video)
Here's an illustration
Flash Video embedded he...
I'd like to use a variable as an key in a dictionary in a Django template. I can't for the life of me figure out how to do it. If I have a product with a name or ID field, and ratings dictionary with indices of the product IDs, I'd like to be able to say:
{% for product in product_list %}
<h1>{{ ratings.product.id }}</h1>
{% endfor...
I'm new to Django and setting up my first site. I have a Share model and a template called share_list.html that uses an object_list like this:
{% for object in object_list %}
I setup haystack using their tutorial and the search template looks like this:
{% for result in page.object_list %}
I would like to modify the search.html tem...
I have an input field that is rendered with a template like so:
<div class="field">
{{ form.city }}
</div>
Which is rendered as:
<div class="field">
<input id="id_city" type="text" name="city" maxlength="100" />
</div>
Now suppose I want to add an autocomplete="off" attribute to the input element that is rendered, how would ...
I just started using lighttpd and fastcgi for my django site, but I've noticed my anchor links are no longer working. I used the anchor links for sorting links on the page, for example I use an anchor to sort links by the number of points (or votes) they have received.
For example:
the code in the html template:
...
{% load sorting...
I have a Blog model, a Post model and a Comment model:
class Blog(models.Model):
title = models.CharField(_('name'), max_length=80)
creator = models.ForeignKey(User, related_name="created_pages")
created = models.DateTimeField(_('created'), default=datetime.now)
description = models.TextField(_('description'), n...
Good afternoon! There are three essences. Product, Option and ProductOption. Product has link many to many to Option through ProductOption. Prompt how to create please for Product'a the form of addition/editing with these options (not on administration page)?
If simply to output {{product.options}} - will be SelectBox with a plural choi...
Say there are navigations, nav1, nav2, nav3 and many subnavs within each of them.
For the css effect, you need to apply class=current to the currently selected navs.
What is the dry way to do that.
For the subnavs, you can check to see if request.get_full_path is the same as the url that subnav refers to, in the base template.
How ca...
The following code snippet in a Django template (v 1.1) doesn't work.
{{ item.vendors.all.0 }} ==> returns "Test"
but the following code snippet, doesn't hide the paragraph!
{% ifnotequal item.vendors.all.0 "Test" %}
<p class="view_vendor">Vendor(s): {{item.vendors.all.0}} </p><br />
{% endifnotequal %}
Any tips on what's wrong...