def get(self): user = users.get_current_user() checklist_q = Checklist.all().filter("user ==", user).filter("deleted ==", False).order("title"); cursor = self.request.get('cursor_cl') if cursor: checklist_q = checklist_q.with_cursor(cursor) checklists = checklist_q.fetch(20) cursor_cl = checklist_q.cursor() checklist_q = checklist_q.with_cursor(cursor_cl) subs_q = Subscription.all().filter("user ==", user).filter("deleted ==", False); cursor = self.request.get('cursor_sub') if cursor: subs_q = subs_q.with_cursor(cursor) subs = subs_q.fetch(20) cursor_sub = subs_q.cursor() subs_q = subs_q.with_cursor(cursor_sub) helpers.createResponse(self, 'dashboard_cls.html', {'checklists': checklists, 'cursor_cl': cursor_cl, 'subs': subs, 'cursor_sub': cursor_sub, 'more_subs': subs_q.count(1) == 1, 'more_cls': checklist_q.count(1) == 1, })
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') 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 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 get(self): user = users.get_current_user() checklist_q = Checklist.all().filter("user ==", user).filter("deleted ==", False).order("title"); cursor = self.request.get('cursor_cl') if cursor: checklist_q = checklist_q.with_cursor(cursor) checklists = checklist_q.fetch(10) checklist_q = checklist_q.with_cursor(checklist_q.cursor()) subs_by_cl = [] for cl in checklists: subs = [] for sub in cl.subscription_set: subs.append(sub) subs_by_cl.append(subs) subs_q = Subscription.all().filter("user ==", user).filter("deleted ==", False); cursor = self.request.get('cursor_sub') if cursor: subs_q = subs_q.with_cursor(cursor) subs = subs_q.fetch(10) subs_q = subs_q.with_cursor(subs_q.cursor()) helpers.createResponse(self, 'dashboard_cls.html', {'checklists': checklists, 'cursor_cl': checklist_q.cursor(), 'subs_by_cl': subs_by_cl, 'subs': subs, 'cursor_sub': subs_q.cursor(), 'more_subs': subs_q.count(1) == 1, 'more_cls': checklist_q.count(1) == 1, })
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( title=self.request.get('title'), public=True, user=users.get_current_user(), deleted=False, ) checklist.put() helpers.createResponse(self, 'new_cl.html', {'cl':checklist})
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 get(self): user = users.get_current_user() checklist_q = Checklist.all().filter("user ="******"deleted ==", False).order("title") cursor = self.request.get('cursor') if cursor: checklist_q = checklist_q.with_cursor(cursor) checklists = checklist_q.fetch(7) helpers.createResponse(self, 'list_cls.html', {'checklists': checklists, 'checklists_cursor': checklist_q.cursor()})
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): 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 get(self): user = users.get_current_user() notifications_q = Notification.all().filter("user == ", user)\ .filter("read ==", False).order("-time") notifications = [] for n in notifications_q: try: n.item_cl.title except ReferencePropertyResolveError: n.delete() else: notifications.append(n) helpers.createResponse(self, 'notifications.html', {'notifications': notifications})
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): 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 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 get(self): helpers.createResponse(self, 'create_cl.html')
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})
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})