Hello,
I think you should use something like alt="{{ object.title }}" /> in your template: you want to output images'
url in your template, not the "object" itself. You'll find explanations
in [1] and [2].
Regards
[1]
http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.
I have the following code that fails to display object images. But
displays normal images fine.
My Model
class News(models.Model):
title---
image = models.ImageField(upload_to='images')
body
Template tag coding
from django import template
register = template.Library()
from -
but is this correct way to get values from two tables and use in
templates?
Me actually want to combine to tables and use there values in template
Is the above post code is correct way to do this?
Combine the in the *view* with the zip() built-in, and use
Steve's suggestion to split the part
> but is this correct way to get values from two tables and use in
> templates?
Me actually want to combine to tables and use there values in template
Is the above post code is correct way to do this?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django
> > I tried this, its not working.
>
> Sorry, but "not working" does not constitute useful information.
>
> My car isn't working. Can you fix it? ;-)
model.py
from django.db import models
from django.forms import ModelForm
class Input(models.Model):
input1 = models.FloatField()
input2 =
On 9/5/2010 12:29 PM, Jagdeep Singh Malhi wrote:
>
>> If these objects are lists, say list1 and list2, in your view just
>> create a single object made up of pairs of elements from the original lists:
>>
>>values = zip(list1, list2)
>>
>> Then you can pass that item to your template and iterat
What error message is it giving you?
I'd assume it's a problem with the objects you're passing it, since
zip is a built-in Python function:
http://docs.python.org/library/functions.html#zip
On Sep 5, 11:29 am, Jagdeep Singh Malhi
wrote:
> > If these objects are lists, say list1 and list2, in yo
> If these objects are lists, say list1 and list2, in your view just
> create a single object made up of pairs of elements from the original lists:
>
> values = zip(list1, list2)
>
> Then you can pass that item to your template and iterate over it.
I tried this, its not working.
--
You recei
On 9/5/2010 7:54 AM, Jagdeep Singh Malhi wrote:
>> I have question about "for loop" used in Templates the correct
>> Syntax of using For Loop in template is : {% for X in VALUE %}
>>
>> but I want to use For loop with two value Is it possible to use two
>> value in one loop? For example : {% for X
I have question about "for loop" used in Templates
the correct Syntax of using For Loop in template is :
{% for X in VALUE %}
but I want to use For loop with two value
Is it possible to use two value in one loop?
For example :
{% for X, Y in VALUE1, VALUE2 %}
Or
{% for X in VALUE1 && Y in VAL
s
> very boring...
>
> So is there some method to implement applying custom variable into
> django template automatically? I find some materials, may be
> RequestContext can handle it, but I don't know how to insert my custom
> variable into it?
>
> Anyone can help?
>
&g
y boring...
>
> So is there some method to implement applying custom variable into
> django template automatically? I find some materials, may be
> RequestContext can handle it, but I don't know how to insert my custom
> variable into it?
>
> Anyone can he
variable into
django template automatically? I find some materials, may be
RequestContext can handle it, but I don't know how to insert my custom
variable into it?
Anyone can help?
Thank you!
--
You received this message because you are subscribed to the Google Groups
"Django users" gr
On Sat, Aug 14, 2010 at 7:40 AM, Antoni Aloy wrote:
> Hello!
>
> Today I have been benchmarking a Django template to PHP compilar
> called Haanga http://github.com/crodas/Haanga/ a development sponsored
> by meneame.net a Digg like spanish site. Ricardo has made some sort of
&
Hello!
Today I have been benchmarking a Django template to PHP compilar
called Haanga http://github.com/crodas/Haanga/ a development sponsored
by meneame.net a Digg like spanish site. Ricardo has made some sort of
benchmark http://gallir.wordpress.com/2010/08/13/haanga-vs-django-vs-h2o.
With my
hi all
thanks for answering my question
i already found the answer
just dont do this it will work
{% load customTags %}
tks
Joseph
On Jul 27, 8:59 am, Joseph wrote:
> thanks , but still doesnt work..
>
> On Jul 27, 8:48 am, Karen Tracey wrote:
>
>
>
> > On Mon, Jul 26, 2010 at 9:18 PM, Joseph
thanks , but still doesnt work..
On Jul 27, 8:48 am, Karen Tracey wrote:
> On Mon, Jul 26, 2010 at 9:18 PM, Joseph wrote:
> > hi
> > the level of directory(named templateTags) is same with the model.py
> > and main.py
> > and i put both __init__.py customTags.py and under templateTags
>
> > for
On Mon, Jul 26, 2010 at 9:18 PM, Joseph wrote:
> hi
> the level of directory(named templateTags) is same with the model.py
> and main.py
> and i put both __init__.py customTags.py and under templateTags
>
> for sure the name __init__.py is correct
>
> i run on AppEngine not Django
>
>
Try naming
hi
the level of directory(named templateTags) is same with the model.py
and main.py
and i put both __init__.py customTags.py and under templateTags
for sure the name __init__.py is correct
i run on AppEngine not Django
would u tell me more detail about this and thanks answering my
question
tks
On Jul 26, 1:56 pm, Joseph wrote:
> hi
> im a newbie if u know please answer me
> i just follow steps of django
> websitehttp://www.djangoproject.com/documentation/0.96/templates_python/
>
> create a directory under inside has two file _init_.py and
> customTags.py
>
> content of customTags.py
>
It's a bit hard to tell in the browser on this webmail account, but I think that
you have the wrong number of underscores before and after "init" in
"__init__.py".
There must be two underscore characters before the word "init" and two after it,
before the ".py".
The tutorial at python.org really i
On 7/26/2010 1:56 PM, Joseph wrote:
> hi
> im a newbie if u know please answer me
> i just follow steps of django website
> http://www.djangoproject.com/documentation/0.96/templates_python/
>
> create a directory under inside has two file _init_.py and
> customTags.py
>
> content of customTags.p
hi
im a newbie if u know please answer me
i just follow steps of django website
http://www.djangoproject.com/documentation/0.96/templates_python/
create a directory under inside has two file _init_.py and
customTags.py
content of customTags.py
from google.appengine.ext.webapp import template
re
yes that is what i meant. can i sort the related objects in the
template?
instead of passing another variable from the views.py
other than that what other built in variables can i access from the
template?
On Jul 19, 11:37 am, Venkatraman S wrote:
> On Mon, Jul 19, 2010 at 11:06 PM, owidjaya wro
On Mon, Jul 19, 2010 at 11:06 PM, owidjaya wrote:
> How can i find out what variable is accessible from the template?
>
You need to pass the result of the query to the template.
Or did you mean accessing the 'related' objects from the passed objects to
the template?
-V
--
You received this me
Hi All,
How can i find out what variable is accessible from the template?
If I have 2 models
Model A:
Name = text
Model B:
Name = text
a = ForeignKey(A)
how can i order the list of "objectA.b_set.all" from the template?
--
You received this message because you are subscribed to the Google
:)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group a
alright, thanks a lot Syed :P
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more
dude I missed 1 important import.
first add this,
-
from django.template import RequestContext
also makesure your template path is set in settings.py
mine looks something like this
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templa
thanks, unfortunately i keep getting a 404, the templates name is
2col.html, its inside ash/templates, the url i have is (r'^paragraph/
$', 'show_para'), and the views is
from django.http import HttpResponse
from django.shortcuts import render_to_response
def show_para(request):
para = "I lo
you can use django render_to_response which by far the most common and
preferred way, i found as newbie my self.
here is an example: (roughly but will give you an idea)
---
Now following this is an extremly crude tut by myself, for a superb one
hey guys, im trying to create a template that uses variables like
{{ paragraph }} , but i cannot find how to get django to render
the paragraph into the variable, i know i have to create a .py file
that uses django's render class to render the paragraph but how can i
connect the html file to the .p
rote:
> I would like to use html frames in Django but my initial experiements
> with it have not worked out.
>
> * Is there anyway to combine HTML frames into a Django
> template {% include t?
>
> * I definitely need Django Context on the right side of the frame,
> t
I would like to use html frames in Django but my initial experiements
with it have not worked out.
* Is there anyway to combine HTML frames into a Django
template {% include t?
* I definitely need Django Context on the right side of the frame,
the left side is strictly navigational and of
Makes sense. Thanks.
On Apr 15, 7:03 pm, Tom Evans wrote:
> On Thu, Apr 15, 2010 at 2:00 PM, chefsmart wrote:
> > Thanks for that tip.
>
> > I can guess what empty_permitted is, but could you explain how
> > empty_permitted is related to can_delete? I couldn't find it in the
> > docs, and such r
On Thu, Apr 15, 2010 at 2:00 PM, chefsmart wrote:
> Thanks for that tip.
>
> I can guess what empty_permitted is, but could you explain how
> empty_permitted is related to can_delete? I couldn't find it in the
> docs, and such relationship is not apparent from the code.
>
> Regards.
>
empty_permi
Thanks for that tip.
I can guess what empty_permitted is, but could you explain how
empty_permitted is related to can_delete? I couldn't find it in the
docs, and such relationship is not apparent from the code.
Regards.
On Apr 15, 3:16 pm, Tom Evans wrote:
> On Thu, Apr 15, 2010 at 6:45 AM, che
On Thu, Apr 15, 2010 at 6:45 AM, chefsmart wrote:
> Hi,
>
> I have an inlineformset with a custom Modelform. So it looks something
> like this:
>
> MyInlineFormSet = inlineformset_factory(MyMainModel, MyInlineModel,
> form=MyCustomInlineModelForm)
>
> I am rendering this inlineformset manually in
Hi,
I have an inlineformset with a custom Modelform. So it looks something
like this:
MyInlineFormSet = inlineformset_factory(MyMainModel, MyInlineModel,
form=MyCustomInlineModelForm)
I am rendering this inlineformset manually in a template so that I
have more control over widgets and javascript
On 09/04/10 12:42, CCC wrote:
now i have a finished template which wrote by j2ee,like this:
Your template stuff (FreeMarker I think?), well, it is not Django.
And Now i want to changeit,write by django,anyone know how to achieve
the "<#break>"
in this tenplate
thanks!
Well, you can't (IIRC
Thanks for reply
I know waht's you mean.
But in the template inside the for loop,there are some 'css',not only
just put the result in the template
That's the difficult i can't solved out
On Apr 12, 4:41 pm, Jirka Vejrazka wrote:
> > the syntax you're u
> the syntax you're using is not standard Django template syntax, so
> unless someone has replaced the default Django tempating system with
> the same one as you did (and is familiar with it and read your email),
> you are unlikely to get a response from this list.
Oops - sorr
>> now i have a finished template which wrote by j2ee,like this:
>> <#list dailyStarList as dailyS>
>> > 0>class="list_color_w"<#else>class="list_color"><#list
Hi,
the syntax you're using is not
which likes
{% for a in as%}
{% for b in bs%}
{%if a.id == b.id%}
some content and exist the for loop
{% endif %}
{% endfor %}
{% endfor %}
any one knows?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
anyone can help?Thanks advance
On Apr 9, 7:42 pm, CCC wrote:
> now i have a finished template which wrote by j2ee,like this:
> <#list dailyStarList as dailyS>
> 0>class="list_color_w"<#else>class="list_color"><#list
> chatAvatarList as cal>
>
now i have a finished template which wrote by j2ee,like this:
<#list dailyStarList as dailyS>
class="list_color_w"<#else>class="list_color"><#list
chatAvatarList as cal>
<#if dailyS.avatarid == cal.id>
$
For anyone else that combines Django with Coda, I've created a mode
for the Django Template language. You can preview it and get more info
from http://joebergantine.com/werkstatt/djangotemplate.
--
You received this message because you are subscribed to the Google Groups
"Django us
On 17 fév, 20:39, Joel Stransky wrote:
> Ok thanks. I never actually tried it, just assumed it wouldn't work. I'll
> give it a shot next time I run into this.
>
FWIW, your current solution is IMHO way cleaner (=> more readable,
more explicit, and less likely to break if / when something changes
Ok thanks. I never actually tried it, just assumed it wouldn't work. I'll
give it a shot next time I run into this.
On Wed, Feb 17, 2010 at 3:49 AM, bruno desthuilliers <
bruno.desthuilli...@gmail.com> wrote:
>
>
> On Feb 16, 10:50 pm, Joel Stransky wrote:
> > That was my first thought too David
On Feb 16, 10:50 pm, Joel Stransky wrote:
> That was my first thought too David but the %} both closes the js method
> declaration and causes a syntax error.
It shouldn't - unless you try to display the unrendered template in
your browser, of course.
--
You received this message because you a
That was my first thought too David but the %} both closes the js method
declaration and causes a syntax error.
Turns out however that you can have more than 1 domready function so I just
enclosed the global ones in a new .js file and appended a completely new
$(document).ready() function in the ch
There are a couple of ways, but here's one off the top of my head:
Base template:
$(function(){
function1() { ... }
function2() { ... }
{% block additional_domready %}{% endblock %}
});
{% block additional_js }%}{% endblock %}
child template that extends base template:
{% block add
Still very new to django so excuse the newbish questions.
This might be obvious but I need a smart solution.
I have a template that runs a jquery function at document ready which
defines a few other functions. I only need a couple of these functions in
the template I'm extending, the other I need
ate language without django (you'll
always end up with django as dependency).
The better way is to use jinja (http://jinja.pocoo.org/2/) it has the same
semantics, quite a lot of it's magic and it's standalone from the start up.
Cheers
> On Feb 11, 8:43 am, Gerson Goulart wrote:
&
Hello Gerson,
This might give you a starting point <
http://docs.djangoproject.com/en/dev/ref/templates/api/#configuring-the-template-system-in-standalone-mode>.
On Feb 11, 8:43 am, Gerson Goulart wrote:
> Is it possible to have the Django Template System running straight
> over Ap
Is it possible to have the Django Template System running straight
over Apache without the need of the whole Django Framework instaled,
let's say, to make it possible to use this template system with other
systems made in other languages such Java, just using this TPL system
process the outp
2010/1/27 mojito :
> I'd like to do something as follows:
>
>
> function namelist(name) {
> .
>
> {% ifequal myname name %}
>
> {% endifequal %}
>
>
> If I hardcode name this works not otherwise, please help.
That doesn't work because
I'd like to do something as follows:
function namelist(name) {
.
{% ifequal myname name %}
{% endifequal %}
If I hardcode name this works not otherwise, please help.
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
to code well. So I ask
> you more professional-minded people out there: Is there an easy way
> (or at least a not-so-difficult way) to convert my Joomla files I have
> now in a .zip folder to a Django template?
>
> Any help would be greatly be appreciated. And a short step-
. So I ask
you more professional-minded people out there: Is there an easy way
(or at least a not-so-difficult way) to convert my Joomla files I have
now in a .zip folder to a Django template?
Any help would be greatly be appreciated. And a short step-by-step
explanation would be amazing!
Than
repared by your view. Django will display excellent
traceback and expose locals() from the view. You can also pass the
data directly to template filters or tags to see the traceback.
On 12 ноя, 21:24, NMarcu wrote:
> Hello all,
>
> How to use French accent on django template? It'
On Fri, Nov 13, 2009 at 4:54 AM, Nicu Marcu wrote:
> Is not coming from database, Db is postgresql, and is set to utf-8, and is
> accept words with accents.
>
>
>
If you post the traceback that goes with the error someone might be able to
help.
Karen
--
You received this message because you ar
Is not coming from database, Db is postgresql, and is set to utf-8, and is
accept words with accents.
2009/11/12 Tom Evans
> On Thu, Nov 12, 2009 at 4:30 PM, rebus_ wrote:
>
>> 2009/11/12 NMarcu :
>> > Hello all,
>> >
>> > How to use French accent on
On Thu, Nov 12, 2009 at 4:30 PM, rebus_ wrote:
> 2009/11/12 NMarcu :
> > Hello all,
> >
> > How to use French accent on django template? It's very strange. in
> > one template is working very well, but in other(templatetag) not, I
> > got this error:
>
2009/11/12 NMarcu :
> Hello all,
>
> How to use French accent on django template? It's very strange. in
> one template is working very well, but in other(templatetag) not, I
> got this error:
>
> TemplateSyntaxError at /operators/ajax
>
> Caught an exception whil
Hello all,
How to use French accent on django template? It's very strange. in
one template is working very well, but in other(templatetag) not, I
got this error:
TemplateSyntaxError at /operators/ajax
Caught an exception while rendering: 'ascii' codec can't encode
I think you'll have to write a custom template tag:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag-and-saving-contents
On Sep 24, 10:56 am, J wrote:
> Hello,
>
> How can I detect whether the template tag truncatewords_html has
> truncated the htm
Hello,
How can I detect whether the template tag truncatewords_html has
truncated the html text or not? My current template code is as follows:
{{ object.body|truncatewords_html:100|removetags:"span"|safe }}
{% trans "Read the rest" %}
»
However, I only want to dis
Daniel Roseman wrote:
> It's an intentional limitation of the template language that you can't
> do that. You'll need to write a custom tag or filter - luckily it can
> be done very trivially as a filter:
>
> @register.filter
> def get_attr(obj, val)
> return getattr(obj, val)
>
> Now in the
On Wed, Sep 23, 2009 at 1:05 PM, Chris Withers wrote:
>
> Hi All,
>
> I have this view function:
>
> def index(request,model,pk=None):
>
> return list_detail.object_list(
> request,
> queryset=model.objects.all(),
> paginate_by=10,
> template_name='index.html',
On Sep 23, 6:05 pm, Chris Withers wrote:
> Hi All,
>
> I have this view function:
>
> def index(request,model,pk=None):
>
> return list_detail.object_list(
> request,
> queryset=model.objects.all(),
> paginate_by=10,
> template_name='index.html',
>
Maksymus007 wrote:
> {{object.name}} ?
no, that is the equivalent of:
getattr(object,'name')
I want:
getattr(object,name)
Subtle, but rather important, difference...
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
-
On Wed, Sep 23, 2009 at 7:05 PM, Chris Withers wrote:
>
> Hi All,
>
> I have this view function:
>
> def index(request,model,pk=None):
>
> return list_detail.object_list(
> request,
> queryset=model.objects.all(),
> paginate_by=10,
> template_name='index.html',
Hi All,
I have this view function:
def index(request,model,pk=None):
return list_detail.object_list(
request,
queryset=model.objects.all(),
paginate_by=10,
template_name='index.html',
extra_context=dict(
column_titles = [f.name for
I'm using django 1.0's templates on GAE.
I've got a for loop that outputs elements. I update their
contents using ajax.
I want to reuse the part of the template that renders the content of
these elements.
I have two handlers that handle /stufflist and /stuff/?
reload=ajax.
The first handler pa
Thanks!
On Aug 17, 11:53 am, David Zhou wrote:
> On Mon, Aug 17, 2009 at 6:39 AM, Adonis wrote:
> > My problem is that even if the 'projects' queryset is empty, it still
> > includes the projects.html
> > Is there another way to do it?
>
> If you're using at least Django 1.1, you can use the emp
On Mon, Aug 17, 2009 at 6:39 AM, Adonis wrote:
> My problem is that even if the 'projects' queryset is empty, it still
> includes the projects.html
> Is there another way to do it?
If you're using at least Django 1.1, you can use the empty tag:
http://docs.djangoproject.com/en/dev/ref/templates
On Mon, Aug 17, 2009 at 5:39 AM, Adonis wrote:
> My problem is that even if the 'projects' queryset is empty, it still
> includes the projects.html
> Is there another way to do it?
Consult the documentation:
http://docs.djangoproject.com/en/dev/ref/templates/builtins/#for-empty
--
"Bureaucrat
Hi all,
I am doing this
{% for item in projects %}
{% include projects.html %}
{% endfor %}
My problem is that even if the 'projects' queryset is empty, it still
includes the projects.html
Is there another way to do it?
Regards,
--~--~-~--~~~---~--~~
You r
On Aug 6, 9:33 pm, NealWalters wrote:
> Is there a keyword that will automatically put the URL of the current
> page in the Django form?
> Or do I have to do that in code and pass it to the form as a normal
> user variable?
>
> Here's what I'm trying to accomplish. I have a feedback form on a bas
Is there a keyword that will automatically put the URL of the current
page in the Django form?
Or do I have to do that in code and pass it to the form as a normal
user variable?
Here's what I'm trying to accomplish. I have a feedback form on a base
template. When the user clicks the feedback but
So what do these filters (humanise, typogrify) do?
I would suggest a truncatesentences, to go along with truncatewords
Daniele Procida wrote:
> I'm doing a demo of some of our Django work soon. Partly, it'll be a
> showcase for Django. One thing I'd like to do is demonstrate Django's
> template
I'm doing a demo of some of our Django work soon. Partly, it'll be a
showcase for Django. One thing I'd like to do is demonstrate Django's
template filters, to show how powerful it is and how it can make a a
contribution to the quality of web output.
So far I have:
* typogrify
* humanize
Are th
A while ago I needed a loop like "for(int i=0; i<20; i++)" within a
Django template. Since the builtin for-loop only iterates over lists
and since there was no appropriate template filter, I created a custom
one.
To me it seems as if this technique isn't well known to many us
Thank you Daniel and Florian (Merci beaucoup. Je parle francais un
petit).
I think that I will be able to use both templates and custom model
methods to accomplish what I am trying.
On Apr 5, 4:18 pm, Daniel Roseman
wrote:
> On Apr 5, 8:49 pm, codecowboy wrote:
>
>
>
> > I posted a question
If you are trying to construct a "base" template for several views you
could
also use the {% if %} tags, and only show the relevant parts of the
page.
For example, if you wanted to display a table, but the number om
columns
would vary, this would enable you to only display the needed columns.
On
On Apr 6, 6:38 am, codingJoe wrote:
> Up front, I'm not the most elegant coder, so please forgive.
>
> I have a page that is produced using django templates. I used the
> templates to do the header and footer, but now I'm down into the body
> of the page. Using the data from my template, I
Up front, I'm not the most elegant coder, so please forgive.
I have a page that is produced using django templates. I used the
templates to do the header and footer, but now I'm down into the body
of the page. Using the data from my template, I am able to fill the
first cell.
Is is possibl
On Apr 5, 8:49 pm, codecowboy wrote:
> I posted a question earlier today about circular imports (http://
> groups.google.com/group/django-users/t/6119e979131c8c25). I now have
> a follow question to that. I've got the following view logic.
>
> def portal(request):
> scientist_id = 1
> s
Did you try to look at Inclusion Tag ?
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags
In template you are not allowed to use some python code... but with an
inclusion tag, you will be able to write this :
{% load related_conferences %}
{% related_conferences scien
I posted a question earlier today about circular imports (http://
groups.google.com/group/django-users/t/6119e979131c8c25). I now have
a follow question to that. I've got the following view logic.
def portal(request):
scientist_id = 1
s = get_object_or_404(Scientist, pk=scientist_id)
> > 1/ Using the i18n internationalization module, I would like to combine
> > the translation with pluralize and capfirst filters. I know I’m a
> > crazy dog.
>
> > {% trans 'tag' %}{{ tag_list|pluralize }}
> > => All right, everything is ok.
>
> > But now, how can I specify the capfirst facili
On Feb 24, 1:19 pm, Brogno wrote:
> Dear djangonauts,
>
> I’m a newbie, a djangonoob ;) So, I have few little questions about
> Django’s template system. Just for you information, I get Django 1.0.2
>
> 1/ Using the i18n internationalization module, I would like to combine
> the translation with
Dear djangonauts,
I’m a newbie, a djangonoob ;) So, I have few little questions about
Django’s template system. Just for you information, I get Django 1.0.2
1/ Using the i18n internationalization module, I would like to combine
the translation with pluralize and capfirst filters. I know I’m a
cr
I decided to write a template tag for my purposes. It's kind of
specific to a dictionary within a dictionary, but here is what I
created:
from django import template
register = template.Library()
def get_term_value(parser, token):
try:
# split_contents() knows not to split quoted st
On Feb 17, 2:01 pm, "euan.godd...@googlemail.com"
wrote:
> Why can't you change the dictionary? Can't you just create a copy of
> the dict and rename the keys in your copy using _ rather than - like
> so:
>
> >>> bad = {'var-1':'Apples', 'var-2':'Pears'}
> >>> good = dict()
> >>> for k,v in bad.
Why can't you change the dictionary? Can't you just create a copy of
the dict and rename the keys in your copy using _ rather than - like
so:
>>> bad = {'var-1':'Apples', 'var-2':'Pears'}
>>> good = dict()
>>> for k,v in bad.items():
>>>good[k.replace('-','_')] = v
>>> good
{'var_1': 'Apples
I have a dictionary of dictionaries that I want to use in a template.
Unfortunately some of the keys are hyphenated (I can't change it), so
when I try to call them in the template using {{ dictionary.key-
name }} it doesn't work:
Could not parse the remainder: '-qualifiers' from
'display.vocabula
I don't think so, but you can do without it. Use {% ifequal %} and
initialize your variable in your views.
On Jan 12, 3:44 pm, rabbi wrote:
> is there a greater than method in the template language?
--~--~-~--~~~---~--~~
You received this message because you are
Advice: Think twice before adding comparisons in the templates.
Conditions and all Bussines Rules(tm) *must* be in the model or the
view.
Time shows this advice punching your face.
On Tue, Jan 13, 2009 at 12:54 PM, Mengsong Chen wrote:
> FYI,
>
> http://www.djangosnippets.org/snippets/12/
>
> O
401 - 500 of 596 matches
Mail list logo