H
H
hheellpp2018-09-18 10:41:36
Django
hheellpp, 2018-09-18 10:41:36

How to get model elements in a template?

in view

def index(request):
      Contact=MapContact.objects.all()

Вhtml
  {{Contact.name}}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mark okolov, 2018-09-18
@okolovmark

pass in the context variable Contact

A
Andrey Burov, 2018-09-18
@BuriK666

https://docs.djangoproject.com/en/2.1/intro/tutori... see on context

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question