Following my question at link text I'd like to separate the features in the template using categories such as Interior, Exterior, Mechanical etc.
I'm trying out the code below, but apparently it's not giving me what I want.
{% for feature in vehicle.features.all %}
{% ifequal vehicle.features.type.type "Interior" %}
<li>{{ feature...
I have some static text that needs to show up at 2 locations within a template.
For example:
<div>
{% if something %}
This is a static text
{% else %}
Something else happened
{% endif %}
</div>
... more html
<span>
{% if something %}
This is a static text
{% else %}
Something else happend
{% endif %}
</span>
I can ...
I would like to learn how I can use nested template tags where the child template tag takes an argument like below:
{% parent_tag {% child_tag arguments %} rest_of_parent_arguments %}
In the above line, I would like to use the return value of child tag as an argument to the parent tag.
...
In my view to render my template I receive different parameters through my request.
According to these parameters I need to render different "part" in my templates.
For example let say that if I receive in my request
to_render = ["table", "bar_chart"]
I want to render a partial template for table and an other for bar_chart
to_rende...
I have a queryset in Django that calls Model.objects.values('item')... where 'item' is a Foreign Key.
class Words(models.Model):
word = models.CharField()
class Frequency(models.Model):
word = models.ForeignKey(Words)
...
So this returns the item id and displays as an id in the template. How do I show the actual item value in ...
My models:
Story:
categories = models.ManyToManyField(Category)
Category: name | slug
My urls:
(r'^(?P<cat_slug>.*)/$', 'news.views.archive_category'),
And in views, I use:
def archive_category(request, cat_slug):
entry = News.objects.get( categories__slug=cat_slug )
return render_to_response('news_archive_category.html...
I have a file called header.html and it is included by base.html. In header.html, I have a list of Categories, which are stored in the database. Now, I want to give that list to header.html. The problem is that no function is known to render the data into this file. So how do I do now. Heartfelt thanks!
...
I am trying to install django-photologue. Everything seems ok, because I install and set up following the official guidelines. I have to upload some photos as examples. However, when viewing a photo or gallery details , then an error as follows:
Caught an exception while rendering: 'Photo' object has no attribute 'get_thumbnail_url'
I...
I want to replace standart {% if %} template tag by "smart if" custom tag from this snippet, because I don't want to write {% load smart_if %} every time. And also "smart if" will come into core template system very soon
I forgot where I saw piece of code, that do this. Does anyone know, how to replace built-in templatetag?
...
I feel like there has to be a cleaner way to do somthing like this. I have 15 or so objects that list out with three on a row. Anyone know a better solutions.
<ul>
{% for object in object_list %}
<li
{% ifequal forloop.counter 1 %}class="first"{% endifequal %}
{% ifequal forloop.counter 4 %}class=...
Q: Is it possible to pull out the value for one of my ModelForm's fields while in the template? If so, how?
Background:
I have a search form that I'm using to allow users to filter down query results. And, the table of results, along with the form can, be exported to an Excel sheet. When the page is rendered w/ the new results, the inpu...
I am trying to loop over a dictionary, specifically the request object's meta property. It is a dictionary, but the following code is treating it like it is a list of strings. How can I do this correctly?
EDIT: I found that if I replace request.META with request.META.items, this works, but why does the following not work? Is it not a di...
say I have the following list that I provide to a django template
stuff= [ { 'a':2 , 'b':4 } , { 'a',7} ]
I want to access the 'a' attribute of the first element. I can't quite get the syntax right.
{{stuff|first}}
gives me the first element, but
{{stuff|first.a}}
is a dead end ( and weird )
and I can't seem to find a attribute...
I would like to have reusable ratings (typical layout with 5 stars).
I have found this http://www.thebroth.com/blog/119/css-rating-stars that explains how to display this using css.
For actually collecting the rating I was thinking of using an image map or maybe simple radio buttons.
I would like to use this on various different models...
I try Netbeans 6.7 for python but don't have a good django template highlight and jquery code completion... i did find a project in google for django for netbeans but they don't explain how to do...
Also I try eclipse with pydev, but have some problems with code competion on my class...
I like to much Netbeans 6.7... I need more of jav...
I need to edit the template shown for editing a specific user. I need to display some additional data that doesn't fit in with an include-style.
I apologise for the short question... but that's pretty much all there is at the moment.
...
Has anyone written a block template tag that joins arbitrary html snippets with some separator, where empty items are omitted?
Could be useful for rendering menu-like lists, where displayed items are determined at run time and items to be joined require elaborate markup.
Thanks.
E.g.:
{% joinitems using ' | ' %}
{% if show_a %}
...
Hi people.
I'm wondering if is it possible to have autocompletion, autoformatting, and those beautiful things working in Eclipse IDE for Django based templates.
Mainly for these things: {% ... %} {{ ... }}
Thanks in advance
...
I try to use django-treemenus.
http://code.google.com/p/django-treemenus/
I create a tree menu (and menu item) using the admin interface.
When I try to load menus using show_meny tag ( below you find my template where I call this tag).
I think I need to call treemenus/menu.html ( given in the sample to start) , but I don't know how?...
I would like to learn how to limit a particular part of a template to be displayed upon the user login. E.g. the greeting message in the home page will be displayed once after the user's successful login but not again on the consecutive visit of the home page during the same session.
I guess it could be possible by use of the HTTP_referr...