Exemple #1
0
test_subject.add_tag("and_another")

test_subject.links =  { "participates_in" : [ "610a4911a5ca67de12cdc1e4b4006f5d" ] }

print(test_subject.to_json())

if test_subject.is_valid():
    print("Valid!")

    success = test_subject.save()

    if success:
        subject_id = test_subject.id
        print("Succesfully saved subject. ID: %s" % subject_id)

        subject2 = Subject.load(subject_id)

        print(test_subject.to_json(indent=4))

        deletion_success = test_subject.delete()

       if deletion_success:
            print("Deleted subject with ID %s" % subject_id)
        else:
            print("Deletion of subject %s failed." % subject_id)
    else:
        print("Save failed")
else:
   print("Invalid...")
   validation_errors = test_subject.validate()
   pprint(validation_errors)