def create_bug(id, deviceid, uid): # fetch tester ID via query, feel like there has to be a better way of doing this but i'll revisit this later tester = Tester.objects(uid=int(uid)).first() bug = Bugs(bugid=int(id), device=Devices.objects(deviceid=deviceid).first().id, tester=tester.id) bug.save() tester.update(push__bugs=bug) tester.save() return bug
def create_tester_device(uid, deviceid): tester = Tester.objects(uid=int(uid)).first() device = Devices.objects(deviceid=int(deviceid)).first() if device in tester.devices: pass else: try: tester.update(push__devices=device) tester.save() except Exception as ex: print(ex) return TesterDevices(device=device.id, tester=tester.id)