code: def save_form(self, request, form, change):
          
          r = form.save(commit=False)
          parent_id = request.GET.get('parent_id', None)
          if not parent_id:
              parent_id = request.POST.get('parent_id', None)
          if parent_id:
              parent = self.get_queryset(request).get(id=parent_id)
              r.parent = parent
          return r
docs: Given a ModelForm return an unsaved instance. ``change`` is True if
          the object is being changed, and False if it's being added.