Re: Template Question

2009-07-13 Thread CrabbyPete
Smartif is great, I don't get why it's not a standard part of django templates. On Jun 17, 5:02 pm, Steve Howell wrote: > Another option is to install the snippet below, which supports "in": > > http://www.djangosnippets.org/snippets/1350/ > > On Jun 17, 1:53 pm, Ben Davis wrote: > > > > > Nope

Re: Template Question

2009-06-17 Thread Steve Howell
Another option is to install the snippet below, which supports "in": http://www.djangosnippets.org/snippets/1350/ On Jun 17, 1:53 pm, Ben Davis wrote: > Nope, you'll need to set a variable in your view.  You can also try creating > your own filter such that {% if friend|is_in_group %}  would wo

Re: Template Question

2009-06-17 Thread Ben Davis
Nope, you'll need to set a variable in your view. You can also try creating your own filter such that {% if friend|is_in_group %} would work (it's pretty easy to do, just check out the docs for custom template filters) On Tue, Jun 16, 2009 at 2:40 PM, CrabbyPete wrote: > > Is there a way do so

Re: Template Question

2008-09-04 Thread unklbeemer
I am using Basic Blog from the Django-Basic-Apps released by Nathan Borror if that helps. On Sep 4, 9:44 am, unklbeemer <[EMAIL PROTECTED]> wrote: > I am wanting to show all blog entries written by certain authors..how > would I go about doing this in my templates. > > In my Blog model I have an

Re: Template Question - What if...

2008-02-12 Thread Peter
Cool, thanks for the tip. I took your latter suggestion and below is a rewrite of the django.template.loader.get_template method. The only additional requirement is the FS_DIR constant that I import from my settings file (which I was already using in settings.py to clean up my TEMPLATE_DIR path

Re: Template Question - What if...

2008-02-11 Thread Malcolm Tredinnick
On Mon, 2008-02-11 at 16:55 -0800, Peter wrote: > I have a bunch of widgets that I access dynamically and they render > their own parts of a page. I would like to give these widgets the > ability to use templates. Furthermore, these are not installed apps, > so I do not have access to the > "dj

Re: template question

2007-11-02 Thread RajeshD
On Nov 1, 9:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have this code in my view, for example: > > a=['a','b','c'] # a list of row labels > b=[1,2,3] # a list of col label > c=tab # an array (list of list) with len(a) rows and len(b) cols. If c[i, j] previously had a value of x,

Re: template question

2007-11-02 Thread [EMAIL PROTECTED]
Nobody can help me ? On 1 nov, 14:56, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have this code in my view, for example: > > a=['a','b','c'] # a list of row labels > b=[1,2,3] # a list of col label > c=tab # an array (list of list) with len(a) rows and len(b) cols. > return render_to_resp

Re: Template question

2007-06-03 Thread sansmojo
You could set an extra context variable in each view that tells whether to display the div. The variable is accessible from the parent template. base.html: {% if show_inset %} {% block inset %}{% endblock %} {% endif %} You could also use a template tag for the whole chunk, but this s

Re: Template question

2007-06-02 Thread Eugene Morozov
On 2 июн, 17:37, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2007-06-02 at 06:07 -0700, Eugene Morozov wrote: > > Hello, > > I have a question which might be trivial to answer, but I didn't found > > answer by scanning the docs. > > In my base template I have defined inset block: > >

Re: Template question

2007-06-02 Thread Malcolm Tredinnick
On Sat, 2007-06-02 at 06:07 -0700, Eugene Morozov wrote: > Hello, > I have a question which might be trivial to answer, but I didn't found > answer by scanning the docs. > In my base template I have defined inset block: > > {% block inset %}{% endblock %} > > I want to remove

Re: Template Question (for loop)

2006-07-28 Thread [EMAIL PROTECTED]
Well, you beat me to it, but I was going to say that a cutsom manager is probably the way I'd do this. :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: Template Question (for loop)

2006-07-28 Thread timster
That's not a bad solution. I just came up with a solution I'm very happy with. I created a custom manager that only returns visible objects. This way I can just do categories = Category.objects.all() and category.forum_set.all() in my template and it will only display visible objects. It works g

Re: Template Question (for loop)

2006-07-28 Thread [EMAIL PROTECTED]
Could create a list and loop through that, e.g. cat_list = Category.objects.filter(visible=True) list = [] for c in cat_list: list.append({"cat":c, "forums":c.forum_set.filter(visible=True, category__visible=True}) Then: {% for x in list %} {{ c.cat.name }} {% if c.forums %} {% for forum in

Re: Template Question (for loop)

2006-07-28 Thread timster
Yuck. I don't want to do it that way. It couples the display logic with the template. If I ever need to change the criteria that determines when to display forums/categories, I will need to change it in two places (view and template). --~--~-~--~~~---~--~~ You rec

Re: Template Question (for loop)

2006-07-28 Thread Javier Rivera
timster escribió: > {% for category in categories %} > {{ category.name }} > {% if category.forum_set.count %} > {% for forum in category.forum_set.all %} > {{ forum.name }} > {% endfor %} > {% else %} > no forums in this category > {% endif %} >

Re: Template question

2006-03-12 Thread Rob Slotboom
Thank you, I'll have a look. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EM

Re: Template question

2006-03-12 Thread Rob Slotboom
Hi Malcolm, {{forloop.counter|add:offset}} works fine. Thanks, Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubs

Re: Template question

2006-03-10 Thread limodou
On 3/10/06, Rob Slotboom <[EMAIL PROTECTED]> wrote: > > Is it possible to add some initial value to a forloop.counter? > > This would be handy when using limit and offset. > > More general, is is possible to use template vars as values for > calculations: > {{ var1 }} + {{ var 2 }} > I'v develop

Re: Template question

2006-03-10 Thread Malcolm Tredinnick
On Fri, 2006-03-10 at 02:41 -0800, Rob Slotboom wrote: > Is it possible to add some initial value to a forloop.counter? > > This would be handy when using limit and offset. > > More general, is is possible to use template vars as values for > calculations: > {{ var1 }} + {{ var 2 }} The first t