I tried launching my Google App Engine app on localhost, and got a Django error I am stuck on.
"TemplateSyntaxError: Template 'base/_base.html' cannot be extended, because it doesn't exist"
I put the templates in a /templates, and then _base.html & index.html in /templates/base . Thanks!
Emile @ proudn00b.com
The Error:
Traceback (m...
I have two 4 tier objects that I am passing to the django template. I am currently for looping through each tier, and going down a level if it exists. I ended up having key, key2 and key3 that represents the current location in the object while looping. I would like to reference the other object that has the same tiers using those variab...
I have some template code that looks like:
<input type='submit' value='{{ need.satisfied|yesno:"Resend this document now,Send this document now" }}' />
I'd like to be able to translate it but that appears to be difficult to accomplish.
http://code.djangoproject.com/ticket/3804 mentions
{{ _("Some String") }}
which appears to work...
I am building an application having to do with game achievements, and I want to display for each game, a page that lists the related achievements. That is done.
However, I also want each user to be able to see in that list which achievements they have completed.
My model is like this:
class Achievement(models.Model):
game = mode...
In my blog app I want to display a list of blog posts and the first image connected to this post. Now I do it this way:
{% for image in entry.image_set.all|slice:"1" %}
<img src="{{ image.get_absolute_url }}">
{% endfor %}
Is there a template shortcut I don't know about, or maybe I should just write my own Manager?
...
I want to delete the records which i select, and run.html will refresh, how can i do that?
Since i use function run in views.py to send records in database, and run need one parameter build which can be got by using run.name, so i think i need to pass "run.name" and "run.id" when i click the submit button.
urls.py
urlpatterns = pattern...
I have a model with a custom property
class RecipeIngredient(models.Model):
recipe = models.ForeignKey(Recipe)
ingredient = models.ForeignKey(Ingredient)
serving_size = models.ForeignKey(ServingSize)
quantity = models.IntegerField()
order = models.IntegerField()
created = models.DateTimeField(auto_now_add = True)...
I want to pass a parameter, when i click submit button.
urls.py
urlpatterns = patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
(r'^home/$', 'views.home'),
(r'^home/(?P<build>[^/]+)/$', 'views.run'),
(r'^run/delete/$', 'views.runDelete')
)
run.html
<form nam...
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...
I'm developing a Django-based site for fun, and wondered if anyone knows how to solve this problem. I want to display images in a table, like a gallery, inside a template. Does anyone know how to do this? I've tried a multidimensional list, but I am getting nowhere.
...
how can i select all checkbox when i click header checkbox?
By javascript? How?
And can i do that in easier method?
thanks:D
run.html
<form name="form" method="post" action="/home/{{build}}/">
<br>
<input type="submit" value="Delete" style="margin-left:149px; width:80px; height:30px">
<input type="hidden" name="build_id" value="{{build...
<script>
function compare(profile_id)
{
{% ifequal '{{profile.id}}' %}
selected_sub='selected';
{% endifequal %}
}
</script>
How to compare {{profile.id}} and javascript variable profile_id
...
My models:
class ItemSet(models.Model):
name = models.CharField(max_length=30)
item = models.ManyToManyField(Item)
order = models.IntegerField(default=0)
class Item(models.Model):
name = models.CharField(max_length=30)
desc = models.CharField(max_length=100)
A set includes many items and a item can be in many sets...
Hi. I have a view like this:
def form1(request):
if request.method == 'POST':
form = SyncJobForm(request.POST)
if form.is_valid():
# do something
in_progress = True
return render_to_response('form1.html', {'in_progress': in_progress})
I would like to know how to set it to refresh the templat...
I want to select all checkbox when i click the top check,
below is my code:
run.html
<script language="JavaScript" src="media/js/jquery-1.4.2.min.js"></script>
<script language="javascript">
$("#selectAll").change(function() {
$(".xxx:checkbox").attr('checked', this.checked);
});
</script>
Select All: <input type="checkbox" id="sele...
i want to compare num and {{buildSummary_list.number}}, but why it is not work?
And i got an error "Could not parse the remainder: '{{buildSummary_list.number}}' from '{{buildSummary_list.number}}'"...
{% for num in buildSummary_list.paginator.page_range %}
{% ifequal num {{buildSummary_list.number}} %}
<b>{{num}}</b>
{%...
Hi guys,
I've two different views (for instance, one for colors and other for cars )
That views point to the same template.
If you click in one color, the template will show all the information about the color selected, same thing whit the car.
What I'm trying to do is to insert a button to go back:
<form action="">
{% ifequal back_t...
Found out about using intcomma with floatformat here, but have not been able to get it working. Here's what I've done:
1) Add django.contrib.humanize to installed apps
2) Add {% load humanize %} to top of template
3) Using {{ feeditem.distance|floatformat(0)|intcomma }} in the code
Interestingly, floatformat:0 and floatformat:"0" did...
How do I refresh a certain element within a django template?
Example:
{% if object.some_m2m_field.all %}
<h3>The stuff I want to refresh is below</h3>
<div id="the-div-that-should-be-refreshed">
{% for other_object in object.some_m2m_field.all %}
<a href="www.example.com">{{ other_object.title }}</a>
...
I am outputting content from my models to my templates, however some model fields call data stored in other models. This happens only in a few fields. I am wondering whether using an if tag to evaluate this would be more efficient compared to storing the django tags inside the models.
Answers to this question say that storing django ta...