def type(self): if self.text != None and self.text != "": return "text" elif self.video != None and self.video != "": return "video" elif self.image != None and self.image != "": return "image" else: logger.log_simple("NO TYPE FOR STORY: " + self.title)
def type(self): if self.text: return "text" elif self.video: return "video" elif self.image: return "image" else: logger.log_simple("NO TYPE FOR STORY: " + self.title)
def add_connection(request, connect_to, to_connect): if Page.objects.filter(pk=to_connect).exists() and Page.objects.filter(pk=connect_to).exists(): page_connect_to = Page.objects.get(pk=connect_to) page_to_connect = Page.objects.get(pk=to_connect) page_connect_to.connections.add(page_to_connect) page_connect_to.save() return HttpResponse('') else: ## TODO: We should notify user of error finding the connection logger.log_simple("Failed to find one of the pages with the given vanity urls") raise Http404
def add_connection(request, connect_to, to_connect): if Page.objects.filter(pk=to_connect).exists() and Page.objects.filter( pk=connect_to).exists(): page_connect_to = Page.objects.get(pk=connect_to) page_to_connect = Page.objects.get(pk=to_connect) page_connect_to.connections.add(page_to_connect) page_connect_to.save() return HttpResponse('') else: ## TODO: We should notify user of error finding the connection logger.log_simple( "Failed to find one of the pages with the given vanity urls") raise Http404