Beispiel #1
0
 def add_book(module_short_title, book_isbn):
     """
     Link a module and a book
     """
     from lib.ModuleBook import ModuleBook
     module_ref = Module.get_by_key_name(module_short_title)
     book_ref = Book.get_by_key_name(book_isbn)
     new_module_book = ModuleBook(module=module_ref, book=book_ref)
     new_module_book.put()
Beispiel #2
0
 def add_book(module_short_title,
              book_isbn):
     """
     Link a module and a book
     """
     from lib.ModuleBook import ModuleBook
     module_ref = Module.get_by_key_name(module_short_title)
     book_ref = Book.get_by_key_name(book_isbn)
     new_module_book = ModuleBook(module=module_ref,
                                  book=book_ref)
     new_module_book.put()
Beispiel #3
0
 def add_book(user_email, book_isbn, book_price, book_condition):
     """
     Add a book to the datastore
     """
     from lib.UserBook import UserBook
     user_ref = User.get_by_key_name(user_email)
     book_ref = Book.get_by_key_name(book_isbn)
     new_user_book = UserBook(user=user_ref,
                              book=book_ref,
                              price=book_price,
                              condition=book_condition)
     new_user_book.put()
Beispiel #4
0
 def remove_book(module_short_title, book_isbn):
     """
     Remove a book from a module
     """
     module_ref = Module.get_by_key_name(module_short_title)
     book_ref = Book.get_by_key_name(book_isbn)
     module_book_ref = db.GqlQuery("SELECT * FROM ModuleBook WHERE " +\
                                   "module = :1 AND " +\
                                   "book = :2",
                                   module_ref,
                                   book_ref)
     db.delete(module_book_ref)
Beispiel #5
0
 def remove_book(module_short_title,
                 book_isbn):
     """
     Remove a book from a module
     """
     module_ref = Module.get_by_key_name(module_short_title)
     book_ref = Book.get_by_key_name(book_isbn)
     module_book_ref = db.GqlQuery("SELECT * FROM ModuleBook WHERE " +\
                                   "module = :1 AND " +\
                                   "book = :2", 
                                   module_ref, 
                                   book_ref)
     db.delete(module_book_ref)
Beispiel #6
0
 def add_book(user_email,
              book_isbn, 
              book_price, 
              book_condition):
     """
     Add a book to the datastore
     """
     from lib.UserBook import UserBook
     user_ref = User.get_by_key_name(user_email)
     book_ref = Book.get_by_key_name(book_isbn)
     new_user_book = UserBook(user=user_ref,
                              book=book_ref,
                              price=book_price,
                              condition=book_condition)
     new_user_book.put()
Beispiel #7
0
 def remove_book(user_email, book_isbn, book_price, book_condition):
     """
     Remove a book from the datastore
     """
     user_ref = User.get_by_key_name(user_email)
     book_ref = Book.get_by_key_name(book_isbn)
     user_book_ref = db.GqlQuery("SELECT * FROM UserBook WHERE " +\
                                 "user = :1 AND " +\
                                 "book = :2 AND " +\
                                 "price = :3 AND " +\
                                 "condition = :4",
                                 user_ref,
                                 book_ref,
                                 book_price,
                                 book_condition)
     db.delete(user_book_ref)
Beispiel #8
0
 def remove_book(user_email,
                 book_isbn, 
                 book_price, 
                 book_condition):
     """
     Remove a book from the datastore
     """
     user_ref = User.get_by_key_name(user_email)
     book_ref = Book.get_by_key_name(book_isbn)
     user_book_ref = db.GqlQuery("SELECT * FROM UserBook WHERE " +\
                                 "user = :1 AND " +\
                                 "book = :2 AND " +\
                                 "price = :3 AND " +\
                                 "condition = :4", 
                                 user_ref, 
                                 book_ref, 
                                 book_price, 
                                 book_condition)
     db.delete(user_book_ref)