title: Django - ModelForm - What if the instance does not exist yet?
body: <p>I have a modelForm that use instance, but the first time the user access the form, the instance does not exist yet. If the instance does not exist there would be an empty form.</p>
  
  <p>Whats is the best way to handle that? Also, how is it possible to delete the instance in the form?</p>
  
  <p>Should I use modelformset_factory with max_number = 1, can_delete= True instead?</p>
  
  <p>view.py:</p>
  
  <pre><code>def setLayerLabel(request, map_id, layerMapOptions_id):
      layerMapOptions = LayerMapOptions.objects.get(pk=layerMapOptions_id)
      layerLabel_selected = LayerLabel.objects.get(layerMapOptions=layerMapOptions)
  
      if request.POST:
          formset = layerLabelForm(request.POST, instance = layerLabel_selected)
          if formset.is_valid():
              instance = formset.save()
      else:
          formset = layerLabelForm(instance = layerLabel_selected)
  
      return render_to_response("basqui/manage_map_layerLabel.html", {'layer_label': layerLabel_selected, 'layerLabelformset': formset, 'layer': layerMapOptions.layer}, context_instance=RequestContext(request))
  </code></pre>
  
  <p>forms.py:</p>
  
  <pre><code>class layerLabelForm(BetterModelForm):
      def __init__(self, *args, **kwargs):
          super(layerLabelForm, self).__init__(*args, **kwargs)
  
  
      class Meta:
          model = LayerLabel
          fieldsets =  [('Label Options:', {'fields': ['field', 'font','font_size', 'font_color', 'halo_radius', 'halo_color', 'offset_x', 'offset_y'], 'classes': ['module']}),]
  </code></pre>