Python, variable interpolation
def object_list(request, model):
obj_list = model.objects.all()
template_name = 'mysite/%s_list.html' % model.__name__.lower()
return render_to_response(template_name, {'object_list': obj_list})
Sharing some thoughtsWe grow our knowledge when we share it unconditionally : )Filed under: programmingPython, variable interpolation
|
|