def search(request, **kwargs): title="pinmyblogs|search" if (request.session.has_key("email") and request.method == "GET"): email=request.session.get("email") numberintrash=returnUrlTrashed(email=email) count=None serch=None if ("search" in request.GET and len(request.GET['search']) > 0): string=request.GET['search'] print (string) serch=Url.objects.filter(user_email=email, url__icontains=string, is_blocked=0, is_delete_parmently=0, is_trashed=0, ).values("url") count=len(serch) print (count) print (serch) return render(request, "search.html", {"title": title, "numberintrash": numberintrash, "search": serch, "count": count })
def home(request): title="pinmyblogs|settings" if (request.session.has_key("email") and request.method == "GET"): email=request.session.get("email") numberintrash=returnUrlTrashed(email=email) q="" try: q=Category.objects.filter(created_by=email, is_blocked=0, ).values(("category_name")) except Exception, e: print ("Here is the error ", e.message) return render(request, "setting.html", {"title": title, "numberintrash": numberintrash, "q": q })
def achiveShow(request): title = "pinmyblogs|archive" q = "" count = None if (request.method == 'GET' and request.session.has_key("email")): email = request.session.get("email") numberintrash = returnUrlTrashed(email=email) try: q = Url.objects.filter(user_email=email, is_blocked=0, is_arhived=1, is_trashed=0, is_delete_parmently=0).values('url') count = q.count() except Exception, e: print("What is the error", e.message)
def edit(request, **kwargs): title = "pinmyblogs|edit" q = None if (request.method == 'GET' and request.session.has_key("email")): email = request.session.get("email") numberintrash = returnUrlTrashed(email=email) if (kwargs.has_key('user_hash')): user_hash = kwargs['user_hash'] categorylist = None try: q = Url.objects.get(user_hash=user_hash, user_email=email, is_blocked=0, is_delete_parmently=0) categorylist = Category.objects.filter( created_by=email, is_blocked=0).values("category_name") print(categorylist.query) print(categorylist) except Exception, e: print("Exception caught ") return render( request, "edit.html", { "title": title, "edit": q, "message": "success", "categorylist": categorylist, "numberintrash": numberintrash, }) return render( request, "edit.html", { "title": title, "edit": q, "message": "success", "numberintrash": numberintrash, })
def category(request, **kwargs): title = "pinmyblogs|category" q = "" if (request.method == 'GET' and request.session.has_key("email")): email = request.session.get("email") numberintrash = returnUrlTrashed(email=email) try: q = Category.objects.filter( created_by=email, is_blocked=0, ).values(("category_name")) except Exception, e: print("What is the error", e.message) return render(request, "category.html", { "title": title, "numberintrash": numberintrash, "q": q })
created_by=email, is_blocked=0, ).values(("category_name")) except Exception, e: print("What is the error", e.message) return render(request, "category.html", { "title": title, "numberintrash": numberintrash, "q": q }) if (request.method == 'POST' and request.session.has_key("email")): email = request.session.get("email") numberintrash = returnUrlTrashed(email=email) try: if ("createnew" in request.POST): new_category = str(request.POST["createnew"]).strip().lower() exists = CategoryList.objects.filter(name=new_category) if (not exists.exists()): CategoryList.objects.create(name=new_category, is_blocked=0) q = Category.objects.create(created_by=email, is_blocked=0, category_name=new_category) else: q = None