I cannot find which part of code print the "+" that is close to every foreign key field.
In fieldset.html there is only the call to {{ field.field }}, but in the file django/forms/widgets.py the code that prints the select, doesn't contain that code, so I suppose that there is a piece of code that manage the foreign key: where is it?
...
I have created a templatetag that loads a yaml document into a python list. In my template I have {% get_content_set %}, this dumps the raw list data. What I want to be able to do is something like
{% for items in get_content_list %}
<h2>{{items.title}}</h2>
{% endfor %}`
...
Hello. I have a Django model with a ManyToManyField and I'm trying to iterate the contents of that field in a comma-delimited list in my template. I'm getting some unexpected results.
{% for painting in paintings_list %}
<p>{% for item in painting.style.all %}
{{ item.style|join:', ' }}
{% endfor %}</p>
{% endfor %}
Th...
Hello,
I have decided to save templates of all system emails in the DB.
The body of these emails are normal django templates (with tags).
This means I need the template engine to load the template from a string and not from a file.
Is there a way to accomplish this ?
Thanks
...
I'm trying to create a basic template to display the selected instance's field values, along with their names. Think of it as just a standard output of the values of that instance in table format, with the field name (verbose_name specifically if specified on the field) in the first column and the value of that field in the second colum...
I have an inline formset for a model, which has a unique_together constraint. And so, when I input data, which doesn't fulfill this constraint, it displays:
__all__Please correct the duplicate values below.
The code, which does this is:
{% for error in formset.errors %}
{{ error }}<br/>
{% endfor %}
I don't much like...
I'm trying to follow the guidelines in this answer, but I'm getting stuck with how to edit the template.
The relevant part of my admin.py:
SegmentFormset = forms.models.inlineformset_factory(Division,Segment)
class DivisionForm(forms.ModelForm):
def __init__(self, **kwargs):
super(DivisionForm, self).__init__(**kwargs)
...
Hi!
It's newbie question, I think.
I want to iterate above two lists: first in for loop and second when some condition is true.
How do it in django template ?
...
Django-compress is great, but it doesn't offer any tags for compressing in-page javascript.
Are there some solutions out there? Even removing newlines (and adding ";" where needed) would be just great.
...
For a new project we're writing documentation about the Django template system. We use Django for the documentation project itself too, so Django picks up all our example variables in the sample code and tries to render them. The only way we found to get around this is to use {% templatetag %}, but that makes our code really unreadable. ...
I'm trying to send a django email with UTF-8 characters in the template, specifically:
S'il vous plaît
I get the error:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x94 in position 147: unexpected code byte
When trying to encode the special "î" character (that is the character at that position.)
Here is my code for genera...
I am applying the 'url' template tag to all links in my current Django project.
I have my urls named like so...
url(r'^login/$', 'login', name='site_login'),
This allows me to access /login at my site's root. I have my template tag defined like so...
<a href="{% url site_login %}">
It works fine, except that Django automatically ...
Hi, I'm new to django and python...
I have a model which includes 10 generic fields attrib_00 through attrib_09.
I pass these fields as a context to a django template string.
I would like to use more meaningful names in the template.
The template strings are fetched from another model and I have in mind adding a field containing a co...
how do I know if a remote user is connected in django?, like gmail chat, or facebook chat... I need that in the templates system. Sorry for my english
...
I read this
"DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST
If TEMPLATE_CONTEXT_PROCESSORS contains this processor, every
RequestContext will contain a variable request, which is the current
HttpRequest. Note that this processor is not enabled by default;
you'll have to activate it. " from this page
http://docs.djangoproject.com/en/dev/ref/tem...
I have a model which have a function to calculate the difference between two fields
Example:
Class MyModel(models.Model):
fieldA = models.FloatField()
fieldB = models.FloatField()
def delta(self):
return self.fieldA - self.fieldB
Id like to use this model in a GenericView. I can use the function delta as an extraC...
The following is a matplotlib code that generates a scatter plot in as the response.
def plot(request):
r = mlab.csv2rec('data.csv')
fig = Figure(figsize=(6,6))
canvas = FigureCanvas(fig)
ax = fig.add_subplot(111)
ax.grid(True,linestyle='-',color='gray')
ax.scatter(r.x,r.y);
response=django.h...
I have a database object called manor_stats, with around 30 fields. For most rows, most of these fields will be null.
In my template, I'd like to loop through all the fields in the row, and print info for only the fields that aren't null.
For example, there's a field called "name": I'd like to print <li>Name: {{ manor_stats.name }}</...
I'm trying to iterate over a dictionary of model values in a Django template - I want to list the verbose_name of each model field alongside its value.
Here's what I have in models.py:
class Manors(models.Model):
structidx = models.IntegerField(primary_key=True, verbose_name="ID")
county = models.CharField(max_length=5, nu...
I am receiving this error in one of my templates and cant seem to figure out what's wrong.
`NoReverseMatch: Reverse for 'getimagefile'
with arguments '(12L, 'afN9LRzESh4I9CGe6tFVoA==\n')' and
keyword arguments '{}' not found.
My urls.py contains:
urlpatterns = patterns('myproj.myapp.views',
url(r'^getimage/(?P<extractedcontent_id>...