Commit 0b0c9a0d authored by Muhamad's avatar Muhamad

edit

parent dbfe6011
from decimal import Context
from django.shortcuts import render, redirect
# from django.views.generic import ListView, DetailView, DeleteView, UpdateView, CreateView
from django.views import View, generic
from django.db import connection as conn
def editkelurahan(request):
if request.method == 'POST':
kode_dagri = request.POST.get('kode_dagri')
print(kode_dagri)
return render (request, 'maps/edit.html')
with conn.cursor() as edit_poly:
edit_poly.execute("SELECT json_build_object('type', 'Feature', 'administrasi', (kode_desa, desa, kecamatan, kab_kota, provinsi, jumlah_pen, jumlah_kk, luas_desa),'penduduk', (pria, wanita, belum_kawin, kawin, cerai_hidup, cerai_mati, wajib_ktp, islam, kristen, khatolik, hindu, budha, konghucu, kepercayaan_lain, u0, u5, u10, u15, u20, u25, u30, u35, u40, u45, u50, u55, u60, u65, u70, u75),'pekerjaan_pendidikan', (tidak_sekolah, belum_tamat, tamat_sd, sltp, slta, diploma_i, diploma_ii, diploma_iv, strata_ii, strata_iii, tidak_bekerja, aparatur_pemerintah, tenaga_pendidik, wiraswasta, pertanian, tenaga_kesehatan, pensiunan, pegawai, tentara, kepolisian, pedagang, petani, peternak, nelayan, karyawan, buruh, pembantu, tukang, pendeta, pastor, ustadz, dosen, guru, pilot, pengacara, notaris, arsitek, akuntan, konsultan, dokter, bidan, perawat, psikiater, sopir, lainnya), 'poi',(jml_puskesma, jml_sekolah, jml_sarib),'geometry', ST_AsGeoJSON(geom :: geometry) :: json) from geo_data_kelurahan where kode_desa = '%s'"% kode_dagri)
res_edit_poly = edit_poly.fetchall()
print(res_edit_poly)
context = {'result_poly': res_edit_poly[0][0]}
return render (request, 'maps/edit.html', context)
if request.method == 'GET':
return redirect("apps:dashboard")
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment