Categories
Uncategorized

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})

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})

By Fabio Pedrazzoli Grazioli

I invest and research in the Blockchain and Cryptocurrency Software Engineering industry.

Love Personal Development, Healthy Living, Nutrition/Detox, Meditation, Yoga and Martial Arts.

https://www.fabiopedrazzoli.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s