def get(self, **args): cl = Checklist.get(Key.from_path("Checklist", long(args['id']))) if not cl or cl.deleted: helpers.createResponse(self, 'message_not_exist.html') return if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return item_q = cl.item_set.filter("deleted ==", False).order("creation_time") cursor = self.request.get('cursor') if cursor: item_q = item_q.with_cursor(cursor) items = item_q.fetch(20) user = users.get_current_user() subscribed = False for sub in Subscription.all().filter("user ==", user).filter("deleted ==", False): if sub.source.key() == cl.key(): subscribed = True break helpers.createResponse(self, 'dashboard_subscribe.html', {'items': items, 'cl': cl, 'cursor_item': item_q.cursor(), 'subscribed': subscribed, }, )
def post(self): cl = Checklist.get(Key.from_path('Checklist', long(self.request.get('cl_id')))) if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return user = users.get_current_user() for sub in Subscription.all().filter("user ==", user).filter("deleted ==", False): if sub.source.key() == cl.key(): helpers.createResponse(self, 'message_already_subscribed.html', {'old_checklist': cl}) sub = Subscription( user=user, source=cl, deleted=False, ) sub.put() for item in cl.item_set: subItem = SubscribedItem( subscription=sub, original=item, finished=False, deleted=False, ) subItem.put() helpers.createResponse(self, 'message_subscribed.html')
def get(self, **args): cl = Checklist.get(Key.from_path("Checklist", long(args['id']))) if not cl or cl.deleted: helpers.createResponse(self, 'message_not_exist.html') return if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return item_q = cl.item_set.filter("deleted ==", False).order("creation_time") cursor = self.request.get('cursor_item') if cursor: item_q = item_q.with_cursor(cursor) items = item_q.fetch(20) subs = [] for sub in cl.subscription_set: subs.append(sub) cursor_item = item_q.cursor() item_q = item_q.with_cursor(cursor_item) helpers.createResponse(self, 'dashboard_items.html', {'items': items, 'cl': cl, 'cursor_item': cursor_item, 'more_items': item_q.count(1) == 1, 'subs': subs, })
def get(self): checklist = Checklist.get(Key.from_path('Checklist', long(self.request.get('cl_id')))) if not helpers.checkPermissionAndRespond(self, cl=checklist): return if not self.addable(checklist): helpers.createResponse(self, 'message_can_not_create_item.html') return helpers.createResponse(self, 'create_item.html', {'checklist': checklist})
def post(self): item = Item.get(Key(self.request.get("key"))) if not helpers.checkPermissionAndRespond(self, item=item): return item.deleted = True item.put() self.response.write("ok")
def post(self): cl = Checklist.get(Key((self.request.get('key')))) if not helpers.checkPermissionAndRespond(self, cl=cl): return for item in cl.item_set: item.deleted = True item.put() cl.deleted = True cl.put() self.response.write('ok')
def get(self, **args): item = Item.get(Key.from_path("Item", long(args['id_item']))) if not item or item.deleted: helpers.createResponse(self, 'message_not_exist.html') return if not helpers.checkPermissionAndRespond(self, item=item, edit=False): return helpers.createResponse(self, 'list_item.html', {'item': item})
def post(self): item = Item.get(Key.from_path('Item', long(self.request.get('item_id')))) if not helpers.checkPermissionAndRespond(self, item=item): return item.deleted = True item.put() for copy in item.item_set: helpers.pushNotification(item, "deleted the task", item.checklist.user, copy.checklist.user , False) helpers.createResponse(self, 'message_deleted.html')
def post(self): checklist = Checklist.get(Key(self.request.get('cl_key'))) if not helpers.checkPermissionAndRespond(self, cl=checklist): return item = Item( title=self.request.get('title'), checklist=checklist, deleted=False) item.put() helpers.createResponse(self, 'new_item.html', {'item': item})
def post(self): checklist = Checklist.get(Key(self.request.get("cl_key"))) if not helpers.checkPermissionAndRespond(self, cl=checklist): return item = Item(title=self.request.get("title"), checklist=checklist, deleted=False) item.put() taskqueue.add(url="/taskqueue/updatesubscription", params={"key": item.key()}) taskqueue.add(url="/taskqueue/updateprogress", params={"cl_key": item.checklist.key()}) helpers.createResponse(self, "new_item.html", {"item": item})
def post(self): checklist = Checklist.get(Key(self.request.get("key"))) if helpers.checkPermissionAndRespond(self, cl=checklist): checklist.title = self.request.get('title') checklist.public = bool(self.request.get('public')) checklist.description = self.request.get('description') checklist.put() for copy in checklist.checklist_set: helpers.pushNotification(checklist, "edited the checklist", checklist.user, copy.user , True) self.redirect('/cl/' + str(checklist.key().id()))
def post(self): item = Item.get(Key(self.request.get("key"))) if not helpers.checkPermissionAndRespond(self, item=item): return item.deleted = True item.put() for subItem in item.subscribeditem_set: subItem.delete() taskqueue.add(url="/taskqueue/removesubscribeditem", params={'key': item.key()}) taskqueue.add(url="/taskqueue/updateprogress", params={'cl_key': item.checklist.key()}) self.response.write("ok")
def post(self): value = self.request.get("value") key, tmp, field = self.request.get("id").rpartition("_") checklist = Checklist.get(Key(key)) if helpers.checkPermissionAndRespond(self, cl=checklist): if field == 'title': checklist.title = value elif field == 'public': checklist.public = value.lower() not in ['no', 'false'] elif field == 'description': checklist.description = value checklist.put() self.response.write(value)
def post(self): cl = Checklist.get(Key.from_path('Checklist', long(self.request.get('cl_id')))) if not helpers.checkPermissionAndRespond(self, cl=cl): return for item in cl.item_set: item.deleted = True item.put() cl.deleted = True cl.put() for copy in cl.checklist_set: helpers.pushNotification(cl, "deleted the checklist", cl.user, copy.user , True) helpers.createResponse(self, 'message_deleted.html')
def post(self): value = self.request.get("value") key, tmp, field = self.request.get("id").rpartition("_") item = Item.get(Key(key)) if helpers.checkPermissionAndRespond(self, item=item): if field == "title": item.title = value elif field == "difficulty": item.difficulty = int(value) elif field == "description": item.description = value item.put() self.response.write(value)
def post(self): checklist = Checklist.get(self.request.get('checklist')) if not helpers.checkPermissionAndRespond(self, cl=checklist): return if not self.addable(checklist): helpers.createResponse(self, 'message_can_not_create_item.html') return item = Item( title=self.request.get('title'), difficulty=int(self.request.get('difficulty')), progress=0, checklist=checklist, deleted=False) if self.request.get('description') != '': item.description=self.request.get('description') item.put() self.redirect("/cl/" + str(checklist.key().id()))
def get(self, **args): cl = Checklist.get(Key.from_path("Checklist", long(args['id']))) if not cl or cl.deleted: helpers.createResponse(self, 'message_not_exist.html') return if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return item_q = cl.item_set.filter("deleted ==", False).order("title") cursor = self.request.get('cursor') if cursor: item_q = item_q.with_cursor(cursor) items = item_q.fetch(7) helpers.createResponse(self, 'list_items.html', {'items': items, 'checklist': cl, 'item_cursor': item_q.cursor()})
def get(self, **args): sub = Subscription.get(Key.from_path("Subscription", long(args['id']))) if not sub or sub.deleted: helpers.createResponse(self, 'message_not_exist.html') return if not helpers.checkPermissionAndRespond(self, sub=sub, edit=False): return subItem_q = sub.subscribeditem_set.filter("deleted ==", False).order("original") cursor = self.request.get('cursor_subItem') if cursor: subItem_q = subItem_q.with_cursor(cursor) subItems = subItem_q.fetch(10) helpers.createResponse(self, 'dashboard_subItems.html', {'subItems': subItems, 'sub': sub, 'cursor_subItem': subItem_q.cursor()})
def post(self): cl = Checklist.get(Key.from_path('Checklist', long(self.request.get('cl_id')))) if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return user = users.get_current_user() for checklist in Checklist.all().filter("user ==", user): if checklist.source.key() == cl.key(): helpers.createResponse(self, 'message_already_subscribed.html', {'old_checklist': cl, 'my_checklist': checklist}) return new_cl = Checklist( title = cl.title, description = cl.description, user = user, progress = cl.progress, public = cl.public, source = cl, deleted = cl.deleted, ) new_cl.put() for item in cl.item_set: new_item = Item( title = item.title, description = item.description, progress = item.progress, progress_description = item.progress_description, difficulty = item.difficulty, original = item, checklist = new_cl, deleted = item.deleted, ) new_item.put() helpers.pushNotification(cl, "subscribed to your Checklist", user, cl.user, True) helpers.createResponse(self, 'message_subscribed.html')
def post(self): cl = Checklist.get(Key.from_path('Checklist', long(self.request.get('cl_id')))) subscribe = self.request.get('subscribe') if not helpers.checkPermissionAndRespond(self, cl=cl, edit=False): return user = users.get_current_user() if subscribe == 'false': for sub in Subscription.all().filter("user ==", user).filter("deleted ==", False): if sub.source.key() == cl.key(): for subItem in sub.subscribeditem_set: subItem.delete() sub.delete() cl.subscribers = cl.subscribers - 1 self.response.write("unsubscribed") else: sub = Subscription( user=user, source=cl, deleted=False, ) sub.put() for item in cl.item_set.filter("deleted ==", False): subItem = SubscribedItem( subscription=sub, original=item, finished=False, deleted=False, ) subItem.put() cl.subscribers = cl.subscribers + 1 self.response.write("subscribed") cl.put()
def post(self): item = Item.get(Key.from_path("Item", long(self.request.get("item_id")))) if helpers.checkPermissionAndRespond(self, item=item): item.title = self.request.get("title") item.description = self.request.get("description") item.difficulty = int(self.request.get("difficulty")) if item.original: if self.request.get('progress') != '' and \ item.progress != int(self.request.get('progress')): item.progress = int(self.request.get('progress')) helpers.updateProgress(item.checklist, item.checklist.user) helpers.pushNotification( item, "updated progress to " + str(item.progress) + " for item", item.checklist.user, item.original.checklist.user, False) item.progress_description = self.request.get('progress_description') item.put() for copy in item.item_set: helpers.pushNotification(item, "edited the task", item.checklist.user, copy.checklist.user , False) self.redirect("/cl/" + str(item.checklist.key().id()) + "/" + str(item.key().id()))
def get(self): item = Item.get(Key.from_path("Item", long(self.request.get("item_id")))) if helpers.checkPermissionAndRespond(self, item=item): helpers.createResponse(self, 'edit_item.html', {'item': item})
def get(self): checklist = Checklist.get(Key.from_path("Checklist", long(self.request.get('cl_id')))); if helpers.checkPermissionAndRespond(self, cl=checklist): helpers.createResponse(self, 'edit_cl.html', {'checklist_to_change': checklist})