How to return the data contained in django model in json format and map it on leaflet

This time, as the title says, we will use restapi to return the data registered in models.py in json format and plot it on the map. I myself have never touched the map app at the beginner level of django, so I would be grateful if you could refer to it when someone with a similar level stumbles.

It's a successful code ↓

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

Recommended Posts

How to return the data contained in django model in json format and map it on leaflet
I'm addicted to the difference in how Flask and Django receive JSON data
How to use Decorator in Django and how to make it
How to get the current weather data and display it on the GUI while updating it automatically
How to install OpenCV on Cloud9 and run it in Python
How to convert DateTimeField format in Django
How to make only one data register on the Django admin screen
How to copy and paste the contents of a sheet in Google Spreadsheet in JSON format (using Google Colab)
[Introduction to Python] How to handle JSON format data
How to count the number of elements in Django and output to a template
Define a division value in Django and easily reflect it on the screen
How to get multiple model objects randomly in Django
How to use fixture in Django to populate sample data associated with a user model
Use slackbot as a relay and return from bottle to slack in json format.
Convert / return class object to JSON format in Python
How to use the model learned in Lobe in Python
How to create a record by pasting a relation to the inheriting source Model in the Model inherited by Django
Return the image data with Flask of Python and draw it to the canvas element of HTML
A story that makes it easier to see Model debugging in the Django + SQLAlchemy environment
How to generate a query using the IN operator in Django
How to get all the keys and values in the dictionary
[TF] How to load / save Model and Parameter in Keras
In Django, how to abbreviate the long displayed string as ....
Notes on how to use marshmallow in the schema library
Freely customize the model. Change the variable name and field name of the model of the Django / Django Rest Framework app ~ How to reflect the deployment on heroku Memo
Introduction to how to use Pytorch Lightning ~ Until you format your own model and output it to tensorboard ~
Determine the date and time format in Python and convert to Unixtime
processing to use notMNIST data in Python (and tried to classify it)
How to give and what the constraints option in scipy.optimize.minimize is
How easy is it to synthesize a drug on the market?
Try to model the cumulative return of rollovers in futures trading
[ROS2] How to describe remap and parameter in python format launch
How to deploy a Django app on heroku in just 5 minutes
How to display bytes in the same way in Java and Python
Export DB data in json format
I made a POST script to create an issue on Github and register it in the Project
How to reflect validation error and input contents on the previous page without using render in the action
How to reflect CSS in Django
Use Cloud Dataflow to dynamically change the destination according to the value of the data and save it in GCS
[Python] How to save the installed package and install it in a new environment at once Mac environment
How to input a character string in Python and output it as it is or in the opposite direction.
Upload data to s3 of aws with a command and update it, and delete the used data (on the way)
Save the audio data acquired by the browser in wav format on the server
Save json data received by mosquitto on docker to db and Elasticsearch
How to divide and process a data frame using the groupby function
How to write the correct shebang in Perl, Python and Ruby scripts
How to get the date and time difference in seconds with python
Build your Django app on Docker and deploy it to AWS Fargate
[Personal memo] Get data on the Web and make it a DataFrame
How to make a container name a subdomain and make it accessible in Docker
Deploy and use the prediction model created in Python on SQL Server
How to deal with garbled characters in json of Django REST Framework
I implemented the VGG16 model in Keras and tried to identify CIFAR10
Try to extract specific data from JSON format data in object storage Cloudian/S3
Since the organization called Cabinet Secretariat has released data in a format other than JSON even though it is written as JSON, I will summarize how to save JSON format data with python
[Rails] How to calculate latitude and longitude with high accuracy using Geocoding API and display it on Google Map
How to save the feature point information of an image in a file and use it for matching
(Diary 1) How to create, reference, and register data in the SQL database of Microsoft Azure service with python
Django ~ Let's display it in the browser ~
How to check the version of Django
How to delete expired sessions in Django