7. Django Python – ORM

django python bahasa indonesia

Menampilkan data pada database tanpa menggunakan query SQL.

def siswa(request):
     list_siswa = Siswa.objects.all()
      context = {     
              'list_siswa': list_siswa, 

     return render(request, 'siswa.html', context)

Edit html.

{% for siswa in list_siswa %}
    {{ siswa.nama_lengkap }}
    {{ siswa.jurusan }}
{% endfor %}

Lanjutkan Membaca Materi Lengkap

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.