Example #1
0
def update_keyslist():
    Key.objects.delete()
    for n in RM130_keys:
        print(str(n) + ': ' + RM130_keys[n])
        key = Key()
        key.name = RM130_keys[n]
        key.keyNumber = n
        key.RoomNumber = '130'
        key.save()

    for n in RM131_keys:
        print(str(n) + ': ' + RM131_keys[n])
        key = Key()
        key.name = RM131_keys[n]
        key.keyNumber = n
        key.RoomNumber = '131'
        key.save()

    for n in RM132_keys:
        print(str(n) + ': ' + RM132_keys[n])
        key = Key()
        key.name = RM132_keys[n]
        key.keyNumber = n
        key.RoomNumber = '132'
        key.save()
Example #2
0
def CreateMachineKey(keyNumber: int, name: str):
    tool = Key()
    tool.name = name
    tool.keyNumber = keyNumber

    tool.save()
    return tool.keyNumber