Lock table(s).

        Locks the object model table so that atomic update is possible.
        Simulatenous database access request pend until the lock is unlock()'ed.

        See http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html

        @param *args: Models to be locked - if None then self.model is used.

def lock(self, *args):
        """
        Lock table(s).

        Locks the object model table so that atomic update is possible.
        Simulatenous database access request pend until the lock is unlock()'ed.

        See http://dev.mysql.com/doc/refman/5.0/en/lock-tables.html

        @param *args: Models to be locked - if None then self.model is used.
        """
        if not args:
            args = [self.model]
        cursor = connection.cursor()
        tables = ", ".join(['%s WRITE' % connection.ops.quote_name(model._meta.db_table) for model in args])
        logger.debug('LOCK TABLES %s' % tables)
        cursor.execute("LOCK TABLES %s" % tables)
        row = cursor.fetchone()
        return row