0
1

More than 3 years have passed since last update.

djangoのmodelに入っているデータをjson形式で返し、leaflet上にマッピングする方法

Posted at

今回は、タイトルにもある通り、models.pyで登録したデータをrestapiを使ってjson形式で返してもらい、それをマップ上にプロットしようというものです。
僕自身、djangoも初心者レベルで地図アプリも触ったことがないので、そのレベルの同じような人が躓いたときに参考にしてもらえると嬉しいです。

うまくいったコードです↓

def index_serialized(request):
    evacuation=Evacuation.objects.all()
    serialized=EvacuationSerializer(evacuation,many=True)
    content=JSONRenderer().render(serialized.data)
    return HttpResponse
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1