Найти - Пользователи
Полная версия: Django как правильно получить список
Начало » Python для новичков » Django как правильно получить список
1
and_07
код

...
def list(request):
    shop_list = Shop.objects.raw('SELECT * FROM test JOIN test1 p ON .....')
    shops = [ {'id':s.id, 'name':s.name,.....} for s in shop_list]
    return render_to_response("list.html", {"shops":shops}, context_instance=RequestContext(request))
FishHook
from django.forms.models import model_to_dict
and_07
один существенный недостаток, он не понимает модели привязанные через ForeignKey и ManyToMany
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB