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..
...
I'm fairly new to both Django and Python. This is my first time using forms and upload files with django. I can get the uploads and saves to the database to work fine but it fails to valid email or check if the users selected a file to upload. I've spent a lot of time reading documentation trying to figure this out. Thanks!
views.py
de...
I'm having trouble getting only a part of an URL with the {% url %} tag.
The URL setup contains this:
url("^delete/(?P<uuid>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})/$",
deleteView,
name = "delete"),
which means to delete an item by its UUID (the view takes a parameter "uuid" as you can see). As I don't wa...
I'm new to django templates, and I'm trying to tweak the admin interface. Right now I'm editing tabular.html in order to control how inlines are displayed. However, I have no idea what variables are available via the context the admin app sends to this template. Is there any quick way to see all variables available?
I know it is possib...
Hello I'm trying to use google visualization API along with django templates system. I got an error that don't know how to fix. The error is the following:
invalid_block_tag
raise self.error(token, "Invalid block tag: '%s'" % command)
django.template.TemplateSyntaxError: Invalid block tag: 'endfor'
The code is:
function drawChar...
I want to add same django form instance on same template. i already add one before and other add dynamically using javascript.
for example 'form" is a django form: newcell.innerHTML = {{ form.firstname }};
The problem is that when i submit the form, in view the request object has only one value (that is not add using javascript). how ca...
All,
i have the following model defined,
class header(models.Model):
title = models.CharField(max_length = 255)
created_by = models.CharField(max_length = 255)
def __unicode__(self):
return self.id()
class criteria(models.Model):
details = models.CharField(max_length = 255)
headerid = models.Forei...
I pass the query with comments to my template:
COMM = CommentModel.gql("ORDER BY created")
doRender(self,CP.template,{'CP':CP,'COMM':COMM, 'authorize':authorize()})
And I want to output the number of comments as a result, and I try to do things like that:
<a href="...">{{ COMM|length }} comments</a>
Thats does not work...
I have a form and a formset on my template. The problem is that the formset is throwing validation error claiming that the management form is "missing or has been tampered with".
Here is my view
@login_required
def home(request):
user = UserProfile.objects.get(pk=request.session['_auth_user_id'])
blogz = list(blog.objects.filt...
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...
Hi All,
I'm still not sure this is the correct way to go about this, maybe not, but I'll ask anyway. I'd like to re-write wordpress (justification: because I can) albeit more simply myself in Django and I'm looking to be able to configure elements in different ways on the page. So for example I might have:
Blog models
A site update me...
This is using the web app framework, not Django.
The following template code is giving me an TemplateSyntaxError: 'for' statements with five words should end in 'reversed' error when I try to render a dictionary. I don't understand what's causing this error. Could somebody shed some light on it for me?
{% for code, name in charts.item...
Hi there
In django, given the following models (slightly simplified), I'm struggling to work out how I would get a view including sums of groups
class Client(models.Model):
api_key = models.CharField(unique=True, max_length=250, primary_key=True)
name = models.CharField(unique=True, max_length=250)
class Purch...
I want to be able to set variables in a template to string values. I wrote a tag, but it doesn't seem to change the context. The intended use is:
{% define "a string" as my_var %}
Update (solved):
class DefineNode(Node):
def __init__(self, var, name):
self.var = var
self.name = name
def __repr__(self):
...
Hi. In my application I need to show in template stocks for my products. So from product view I'm returning variable {{stock}} which is my amount and then I'm trying to use it in template :
<div class="bar_in" width="{% widthratio {{stock}} 10 100 %}px" style="background:black;"></div>
But it constantly give me "Could not parse the re...
There is a form ,which is submitted and then the page is redirected to another page.But if the user hits the refresh button again on the new page .the following message is displayed
To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.
And on...
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...
The title may be a little confusing, but I don't know how else to call it.
I would like to create a Django project with a large set of applications you could arbitrary turn on or off using INSTALLED_APPS option in settings.py (you would obviously also need to edit urls.py and run syncdb). After being turned on an app should be able to a...
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...
My Model
class Player(models.Model):
player_name = models.CharField(max_length=50)
player_email = models.CharField(max_length=50)
def __unicode__(self):
return self.player_name
My Root urls.py
urlpatterns = patterns('',
(r'^kroster/', include('djangosite.kroster.urls')),
(r'^admin/(.*)', admin.site.root),
)
My ...