def update_or_create(self, attributes, values=None, joining=None, touch=True):
        """
        Create or update a related record matching the attributes, and fill it with values.

        :param attributes: The attributes
        :type attributes: dict

        :param values: The values
        :type values: dict

        :rtype: Model
        """
        if values is None:
            values = {}

        instance = self._query.where(attributes).first()

        if instance is None:
            return self.create(values, joining, touch)

        instance.fill(**values)

        instance.save({"touch": False})

        return instance
def update_or_create ( self , attributes , values = None , joining = None , touch = True ) : if values is None : values = { } instance = self . _query . where ( attributes ) . first ( ) if instance is None : return self . create ( values , joining , touch ) instance . fill ( ** values ) instance . save ( { "touch" : False } ) return instance
Create or update a related record matching the attributes, and fill it with values.

        :param attributes: The attributes
        :type attributes: dict

        :param values: The values
        :type values: dict

        :rtype: Model