title: Cannot save GeoDjango Point in model
body: <p>I'm building a website with Django and, in some page, the user can use a geolocation system to save its current location. At the beginning, the page display a google map centered on a random location. Then the user clicks on a button, it locates him and its current location is displayed on the map. The field <code>latitude</code> and <code>longitude</code> of a form are automatically filled. After that, the user can submit the form and a view is responsible for saving a Point object in the database with the latitude and the longitude. The problem is that the Point is not created : when I go to the admin interface, we see that the location attribute is not initialized and when I try to get the <code>latitude</code> and <code>longitude</code> from the Point in another view, I get the error <code>'NoneType' object has no attribute 'y'</code> that proves that the Point is never created. I don't understand why because the view correctly get the latitude and longitude values (I display them in a message to be sure they are correct).</p>
  
  <p>Here is the relevant parts of my code :
  models.py</p>
  
  <pre><code>from django.contrib.gis.db import models as models2
  
  class UserAdvanced(models2.Model):
      localisation = models2.PointField(blank = True, null = True)
  </code></pre>
  
  <p>forms.py</p>
  
  <pre><code>class LocationForm(forms.Form):
      latitude = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
      longitude = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>from django.contrib.gis.geos import Point
  
  def inscription_fin(request):
      if request.method == "POST":
          form = LocationForm(request.POST)
          if form.is_valid():
              longitude = float(form.cleaned_data['longitude']) #float(request.POST.get('longitude')) : I've tried this also but it doesn't work either.
              latitude = float(form.cleaned_data['latitude']) #float(request.POST.get('latitude'))
              request.user.useradvanced.localisation = Point(longitude, latitude)
              messages.success(request, "Latitude : " + str(latitude) + " / Longitude : " + str(longitude))
              return redirect("home")
      else:
          form = LocationForm()
  
      return render(request, 'inscription/inscription_fin.html', {'form': form})
  </code></pre>
  
  <p>html</p>
  
  <pre><code>&lt;button id="find-me" class="btn btn-lg btn-outline-primary btn-login text-uppercase font-weight-bold mb-2"&gt;Localisez-moi maintenant&lt;/button&gt;&lt;br/&gt;
  &lt;div id="map" style="height: 100%"&gt;&lt;/div&gt;
  &lt;p id = "status"&gt;&lt;/p&gt;
  &lt;form method="post" action="" enctype="multipart/form-data"&gt;
    {% csrf_token %}
    &lt;div class="fieldWrapper form-group"&gt; Latitude : &lt;input type="text" name="latitude" value="" id="latitude" required="required"/&gt;&lt;/div&gt;
    &lt;div class="fieldWrapper form-group"&gt; Longitude : &lt;input type="text" name="longitude" value="" id="longitude" required="required"/&gt;&lt;/div&gt;
    &lt;input type="submit" class="btn btn-lg btn-outline-primary btn-block btn-login text-uppercase font-weight-bold mb-2" value="Soumettre ma localisation" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>javascript</p>
  
  <pre><code>&lt;script src="https://maps.googleapis.com/maps/api/js?key=MY_KEY&amp;callback=initMap" async defer&gt;&lt;/script&gt;
  &lt;script&gt;
    function initMap() {
      lln = {lat: 50.66981991272638, lng: 4.615554319641566}
      var map = new google.maps.Map(document.getElementById('map'), {center: lln, zoom: 15});
      var marker = new google.maps.Marker({position: lln, map: map});
    }
  
    function geoFindMe() {
      const status = document.querySelector('#status');
      var map;
  
      function success(position) {
        const latitude  = position.coords.latitude;
        const longitude = position.coords.longitude;
  
        status.textContent = '';
        document.getElementById('longitude').value = longitude;
        document.getElementById('latitude').value = latitude;
        loc = {lat: latitude, lng: longitude}
        map = new google.maps.Map(document.getElementById('map'), {center: loc, zoom: 17});
        var marker = new google.maps.Marker({position: loc, map: map});
     }
  
     function error() {
       status.textContent = 'Nous ne parvenons pas à obtenir votre localisation. Veuillez réessayer plus tard.';
     }
  
     if (!navigator.geolocation) {
       status.textContent = 'La géolocalisation n\'est pas supportée par votre navigateur';
     }
     else {
       status.textContent = 'Localisation…';
       navigator.geolocation.getCurrentPosition(success, error);
     }
   }
  
   document.querySelector('#find-me').addEventListener('click', geoFindMe);
  &lt;/script&gt;
  </code></pre>
  
  <p>I know the error is probably dummy but I've searched a lot and I can't find the solution by myself. I thank you in advance for your reponse !</p>