django-template

Render one queryset into 2 div columns (django template)

Is there a good way to render the enumeration of a queryset into two div columns? Using 960 grid, I've got something to the effect of... <div class="container_16"> <div class="grid_8 alpha"></div> <div class="grid_8 omega"></div> </div> In Django, one model needs to have it's enumerated contents rendered in both of those colu...

How do I modify the HttpResponse object in django ?

I need the html returned using render_to_response to be escaped. I am unable to find any suitable documentation. Can someone point in some direction ? the code is : return render_to_response(template_name, {return render_to_response(template_name, { 'form': form, redirect_field_name: redirect_to, 'si...

django featured content field

Hi, Sent a question yesterday but I wasn't too clear on what I am attempting. I'm struggling to find any useful tutorials on how best to achieve this so a nudge in the right direction would be greatly appreciated. I've set up a model which references django_content_type. My idea is to use this model to reference other models so that th...

django, admin template error Caught an exception while rendering: 'NoneType' object has no attribute 'label'

good day guys! in project, among others, have models: class Category(models.Model): name = models.CharField(max_length = 50, blank = False, null = False) def __unicode__(self): return "Category %s" % self.name class Meta: db_table = "categories" managed = False class Site(models.Model): user...

Dumps and loads in django

from django.utils.simplejson import dumps, loads # -*- coding: utf-8 -*- def index(request): return render_to_response('test2/index.html') def add_lang(request): logging.debug("Got request") a = request.POST logging.debug(a["lang"]) lang=dumps(a["lang"]) l = Language(code=lang) l.save() lang=loads(lang) lo...

custom template operator

Is it possible? I know about filters, but is it possible to create something like this: {% if 75 is_divisible_by 5 %} It just looks a lot nicer than: {% if 75|is_divisible_by:5 %} (this is a concept question, is_divisible_by is just an example) ...