def u_topic(request,username,utopic): "kullanıcıların kendi hesaplarında açmış olduğu konulara yönlendirme" user = User.objects.filter(username = username)[0] queryset = Content.objects.filter(user = user,content_list = utopic) if not queryset.exists(): ms.error(request,"{} adlı kullanıcı nın {} adlı bir içerik listesi yoktur".format(username,utopic)) return HttpResponseRedirect("/") info_of_cards = content_cards(request,queryset) nav_category = ContentList.objects.filter(user = user) html_head = dict( title = username+" - "+utopic+" | coogger", keywords = username+" "+utopic+","+utopic, description = username+" kullanıcımızın "+utopic+" adlı içerik listesi", author = get_facebook(user), ) context = dict( content = info_of_cards[0], content_user = user, paginator = info_of_cards[1], nav_category = nav_category, nameoftopic = utopic, nameoflist = "Listeler", head = html_head, hmanynotifications = hmanynotifications(request), user_follow = users_web(user), ) template = "users/user.html" return render(request,template,context)
def home(request): info_of_cards = content_cards(request, hmany=10) context = dict( content=info_of_cards[0], paginator=info_of_cards[1], hmanynotifications=hmanynotifications(request), ) template = "card/blogs.html" return render(request, template, context)
def main_detail(request, blog_path, utopic, path): "blogların detay kısmı " ip = get_ip(request) ctof = Content.objects.filter queryset = ctof(url=blog_path)[0] content_user = queryset.user if not Contentviews.objects.filter(content=queryset, ip=ip).exists(): Contentviews(content=queryset, ip=ip).save() queryset2 = queryset # değişeceği için kopyalıyorum queryset.views = F("views") + 1 queryset.save() queryset = queryset2 # değiştikten sonra yine eski değerine atıyorum # bundan dolayı okuma hemen 1 artmış olmaz del queryset2 # silelim # açılan makale bittikten sonra okunulan liste altındaki diğer paylaşımları anasayfadaki gibi listeler content_id = queryset.id nav_category = ctof(user=content_user, content_list=utopic) nav_list = [] for nav in nav_category: # şuan okuduğu yazının öncesi if nav.id < content_id: if len(nav_list) < 6: nav_list.append(nav) nav_list.append(queryset) # şuan okuduğu yazı for nav in nav_category: # sonrası if nav.id > content_id: if len(nav_list) < 3: nav_list.append(nav) nav_category = nav_list info_of_cards = content_cards(request, nav_category, 5) context = dict( head=html_head(queryset), content_user=content_user, nav_category=nav_category, nameoftopic=queryset.title, nameoflist=utopic, stars=stars(queryset), content=info_of_cards[0], detail=queryset, global_hashtag=[i for i in queryset.tag.split(",") if i != ""], comment_form=Comment.objects.filter(content=queryset), hmanynotifications=hmanynotifications(request), user_follow=users_web(content_user), ) template = "detail/main_detail.html" return render(request, template, context)
def hashtag(request, hashtag): queryset = Content.objects.filter(tag__contains=hashtag) info_of_cards = content_cards(request, queryset) html_head = dict( title="#" + hashtag + " | coogger", keywords=hashtag, description=hashtag + " konu etiketi altında ki bütün coogger bilgilerini gör", ) context = dict( content=info_of_cards[0], nameofhashtag=hashtag, paginator=info_of_cards[1], head=html_head, hmanynotifications=hmanynotifications(request), ) template = "card/blogs.html" return render(request, template, context)
def users_list(request, list_): queryset = Content.objects.filter(content_list=list_) info_of_cards = content_cards(request, queryset) html_head = dict( title=list_, keywords=list_, description=list_ + " liste etiketi altında ki bütün coogger bilgilerini gör", ) context = dict( content=info_of_cards[0], nameoflist_ex=list_, paginator=info_of_cards[1], hmanynotifications=hmanynotifications(request), head=html_head, ) template = "card/blogs.html" return render(request, template, context)
def search(request): query = request.GET["query"].lower() q = Q(title__contains=query) | Q(content_list__contains=query) | Q( tag__contains=query) queryset = Content.objects.filter(q).order_by("-views") info_of_cards = content_cards(request, queryset, hmany=20) data_search = SearchedWords.objects.filter(word=query) if data_search.exists(): data_search = data_search[0] data_search.hmany = F("hmany") + 1 data_search.save() else: SearchedWords(word=query).save() context = dict( content=info_of_cards[0], paginator=info_of_cards[1], ) template = "card/blogs.html" return render(request, template, context)
def user(request,username): "herhangi kullanıcının anasayfası" user = User.objects.filter(username = username)[0] queryset = Content.objects.filter(user = user) info_of_cards = content_cards(request,queryset) html_head = dict( title = username+" | coogger", keywords =username+","+user.first_name+" "+user.last_name, description =user.first_name+" "+user.last_name+", "+username+" adı ile coogger'da", author = get_facebook(user), ) context = dict( content = info_of_cards[0], content_user = user, paginator = info_of_cards[1], user_follow = users_web(user), nav_category = ContentList.objects.filter(user = user), head = html_head, hmanynotifications = hmanynotifications(request), ) template = "users/user.html" return render(request,template,context)