code: def replace(self, request, id):
          
          try:
              object = self.model.objects.get(id=id)
          except self.model.DoesNotExist:
              return self._render(
                  request = request,
                  template = '404',
                  context = {
                      'error': 'The %s could not be found.' % self.model.__name__.lower()
                  },
                  status = 404,
                  prefix_template_path = False
              )
  
          form = (self.form or generate_form(self.model))(request.PUT, instance=object)
  
          if form.is_valid():
              object = form.save()
  
              return self.show(request, id)
          else:
              return self._render(
                  request = request,
                  template = 'edit',
                  context = {
                      'form': form
                  },
                  status = 400
              )
docs: Replace an object.