Creating assets by clicking on the map

Hello. I used django-geodjango to provide geo asset management and created tables for asses. Then I linked them to my database and cesium. When I create geo-assets from the django admin panel, I can show them automatically thanks to the cesium gejson feature (you can see it in the screenshot). Is it possible to create geo-asset and save it in my database by clicking on the map over cesium without entering the django admin panel?

Welcome to the Cesium Community!

You can use the pickPosition function to get the position of a mouse click, then create the geojson at the position of the mouse click. Here is an example code snippet:

var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function (event) {
  // We use `viewer.scene.pickPosition` to get position of the mouse click (use `viewer.pickEllipsoid` instead if no terrain layer is provided)
  var earthPosition = viewer.scene.pickPosition(event.position);
  //console.log(earthPosition);
  // `earthPosition` will be undefined if our mouse is not over the globe.
  if (Cesium.defined(earthPosition)) {
     // Create the geojson asset at earthPosition
 }
})

Thank you. So how do I ensure that the geometries I will draw are saved in the database?