def save_criteria(self, request):
        """
        Saves all passed criteria (via request.POST) to the object.
        """
        # First we delete all existing criteria objects for the given object.
        for co in self.get_criteria():
            co.delete()

        # Then we add all passed criteria to the object.
        for key, model in request.POST.items():
            if key.startswith("type"):
                try:
                    id = key.split("-")[1]
                except KeyError:
                    continue

                # Get the values for the criterion
                operator = request.POST.get("operator-%s" % id)
                position = request.POST.get("position-%s" % id)

                criterion_class = import_symbol(model)
                criterion = criterion_class.objects.create(content=self, operator=operator, position=position)

                if criterion.get_value_type() == criterion.MULTIPLE_SELECT:
                    value = request.POST.getlist("value-%s" % id)
                else:
                    value = request.POST.get("value-%s" % id)

                criterion.update(value)
dataset/ETHPy150Open diefenbach/django-lfs/lfs/criteria/base.py/Criteria.save_criteria/original