django-templates

Django localized templates

How can create multilingual Django site? Is it a good idea to create template set for each language? How should I use that sets of templates (if it's a good idea)? ...

Django Template Error : Template u'base.html' cannot be extended

I get this error when I run a django app (dpaste) Template error In template c:\python\projects\mycms\dpaste\templates\dpaste\base.html, error at line 1 Template u'base.html' cannot be extended, because it doesn't exist 1 {% extends "base.html" %} But the "base.html" do exist in the template directory and it has this one line in ...

Reverse foreign key to django-fts searchable model in template

I have a pair of Django models with a foreign key, one of which is searchable with django-fts, say: class Foo(models.Model): ... class Bar(fts.SearchableModel): foo = models.ForeignKey(Foo) When I have an instance of Foo, in view I can insert print foo.bar_set.all() and I see an array of results. However if I try to use it in...

How can I use a Django template tag for greater than on a forloop.counter?

I want the effect of an "ifgt" template tag in a django template page: {%ifgt forloop.counter 10%}<!---special greater than 10 code--!>{%endif%} ...

common components in django

Hi all, I know i can have common stuff like this in django <html> {% include "header.html" %} <div id = 'content'> blah </div> {% include "footer.html" %} </html> but it seems i need to pass data footer.html and header.html every time i include these pages? Thanks ...

ajax post for django template

HI all, I have a problem when i want to submit value then full page again reload. I want to update my table with asynchronous call, that specific information will be loaded but full page not... plz help me aboput this...thanks ...

In Django, how do you construct a formset manaully in a template?

I am constructing the pieces of a formset manually in a template. How do I get the hidden fields TOTAL_FORMS and INITIAL_FORMS. Is there a hidden display widget with them in it already there that I can call? <label>formset title</label> #formset.TOTAL_FORMS #formset.INITIAL_FORMS {% for form in formset.forms %} {{form.field}} {{...

Iterating over model attributes when creating a template in Django

I'm using Django in Google App Engine. If I have the class class Person(): first_name = StringProperty() last_name = StringProperty() and I have an instance where Person.first_name = Bob and Person.last_name = Vance, can I create a template that iterates over the Person attributes to produce: <tr> <td>First</td> <td>Bob</td>...

Django Template: Nested Dictionary "for" tag inside of List "for" tag

I'd like to be able to iterate over a dictionary while inside of a for loop in a Django template. For the sake of this sample, consider the following: items_list = [ {'key1':'value1', 'key2':'value2'}, {'key1':'value5', 'key2':'value9'} ] Method #1: {% for dict in items_list %} {% for key,value in dict %} <tr> ...

Whats the best way to duplicate data in a django template?

<html> <head> <title>{% block title %}{% endblock %}</title> </head> <body> <h1>{% block title %}{% endblock %}</h1> </body> </html> This is my template, more or less. The h1 heading is always the same as the title tag. The above snippet of code is not valid because there can't be two blocks with the sa...

Load a Django template tag library for all views by default

I have a small typography related templatetag library that I use on almost every page. Right now I need to load it for each template using {% load nbsp %} Is there a way to load it "globally" for all views and templates at once? Putting the load tag into a base template doesn't work. ...

excel in django

Hi,How can i make user to downlaoad a excel from the django app.i HAVE A MODEL WHICH gives the report.Now i want a option from user can download the file in excel form.ANy Solution ...

How to give an "included" template additional context?

Is there possibility to narrow context for include. For example, I have "for" tag that gets from posts array - one post. Than I wonna put this post inside "include" tag to render in more detail context. Is there custom tags for this? ...

Dynamic templates in Django

I'm about to make a dynamic website in Django so that user can change the template the website is based upon....for new users, they'll have to choose a template they like from a menu, after which this is stored in a cookie for future reference. I however don't know how to do this....any ideas. ...

Sorting and indexing into a list in a Django template?

How can you perform complex sorting on an object before passing it to the template? For example, here is my view: @login_required def overview(request): physicians = PhysicianGroup.objects.get(pk=physician_group).physicians for physician in physicians.all(): physician.service_patients.order_by('bed__room__unit', 'bed__room__orde...

CopyBlock tag for Django

How can write tag "copyblock" for Django templates? For such a functional:: <title> {% block title %} some title... {% endblock %} </title> <h1>{% copyblock title %}</h1> Thx! ...

Writing a Template Tag in Django

I'm trying to customise a CMS written in Django. The content editors aren't flexible enough so I'm trying to come up with a better solution. Without over-explaining it, I'd like it to be a bit like django-better-chunks or django-flatblocks. You set up an editable region entirely from within the template. I want to bind these editable re...

Django custom template tags and template loaders

[I have this discussion at http://groups.google.com/group/django-users/browse_thread/thread/989c569d5118980d] Is 'django.template.loaders.app_directories.load_template_source' required in the TEMPLATE_LOADERS setting for custom template tags to work? We know that simply having a custom tag in the templatetags directory of your Django ...

Django : error with custom inclusion_tag, can't find file

I'm trying to write a custom inclusion_tag in django. Following the example on http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ I'm just writing @register.inclusion_tag('test.html') where test.html is a file in the same directory ( apps/my_app/templatetags) as the .py file which defines it. But I'm getting a Templa...

Google app engine ReferenceProperty relationships

Hi guys, I'm trying to get my models related using ReferenceProperty, but not have a huge amount of luck. I have 3 levels: Group, Topic, then Pros, and Cons. As in a Group houses many topics, and within each topic could be many Pros and Cons. I am able to store new Groups nice and fine, but I don't have any idea how to store topics und...