Esempio n. 1
0
 def get_context_data(self, **kwargs):
     context = super(Home, self).get_context_data(**kwargs)
     if self.request.community_model.name == "coogger":
         queryset = Content.objects.filter(status="approved")
     else:
         queryset = Content.objects.filter(
             community=self.request.community_model, status="approved")
     context["content"] = paginator(self.request, queryset)
     return context
Esempio n. 2
0
 def get(self, request, *args, **kwargs):
     # TODO:  buradaki işlemin daha hızlı olanı vardır ya
     q = Q(status="shared") | Q(status="changed")
     if self.request.community_model.name == "coogger":
         queryset = Content.objects.filter(q)
     else:
         queryset = Content.objects.filter(q).filter(
             community=request.community_model)
     info_of_cards = paginator(request, queryset)
     context = dict(content=info_of_cards, )
     return render(request, self.template_name, context)
Esempio n. 3
0
 def get_context_data(self, **kwargs):
     for attr, value in self.request.GET.items():
         try:
             self.queryset = self.queryset.filter(**{attr: value})
         except FieldError:
             pass
     info_of_cards = paginator(self.request, self.queryset)
     context = super(Filter, self).get_context_data(**kwargs)
     context["content"] = info_of_cards
     context["filter"] = True
     return context
Esempio n. 4
0
 def get_context_data(self, cat_name, **kwargs):
     if cat_name != "":
         if self.request.community_model.name == "coogger":
             queryset = self.ctof(category=cat_name, status="approved")
         else:
             queryset = self.ctof(community=self.request.community_model,
                                  category=cat_name,
                                  status="approved")
         info_of_cards = paginator(self.request, queryset)
         context = super(Categories, self).get_context_data(**kwargs)
         context["content"] = info_of_cards
         context["category"] = cat_name
         return context
Esempio n. 5
0
 def get(self, request, *args,
         **kwargs):  # TODO:  buradaki işlemin daha hızlı olanı vardır ya
     oof = []
     queryset = []
     for i in Following.objects.filter(user=request.user):
         i_wuser = i.which_user
         oof.append(i.which_user)
     for q in Content.objects.filter(status="approved"):
         if q.user in oof:
             queryset.append(q)
     info_of_cards = paginator(request, queryset)
     context = dict(content=info_of_cards, )
     return render(request, self.template_name, context)
Esempio n. 6
0
 def get_context_data(self, list_, **kwargs):
     if list_ != "":
         queryset = self.ctof(content_list__contains = list_,status = "approved")
         info_of_cards = paginator(self.request,queryset)
         context = super(Userlist, self).get_context_data(**kwargs)
         html_head = dict(
          title = list_+" | coogger",
          keywords = list_,
          description = list_ +" {} altında ki bütün coogger bilgileri".format(self.info),
         )
         context["content"] = info_of_cards
         context["nameofhashtag"] = list_
         context["head"] = html_head
         return context
Esempio n. 7
0
 def get(self, request, *args,
         **kwargs):  # TODO:  buradaki işlemin daha hızlı olanı vardır ya
     queryset = []
     for q in Content.objects.filter(community=request.community_model,
                                     status="approved"):
         if q.user.username in self.steem_following(
                 username=request.user.username):
             queryset.append(q)
     info_of_cards = paginator(request, queryset)
     context = dict(content=info_of_cards, )
     if queryset == []:
         ms.error(
             request, "You do not follow anyone yet on {}.".format(
                 request.community_model.name))
     return render(request, self.template_name, context)
Esempio n. 8
0
 def get_context_data(self, lang_name, **kwargs):
     if lang_name != "":
         if self.request.community_model.name == "coogger":
             queryset = Content.objects.filter(language=lang_name,
                                               status="approved")
         else:
             queryset = Content.objects.filter(
                 community=self.request.community_model,
                 language=lang_name,
                 status="approved")
         info_of_cards = paginator(self.request, queryset)
         context = super(Languages, self).get_context_data(**kwargs)
         context["content"] = info_of_cards
         context["language"] = lang_name
         return context
Esempio n. 9
0
 def get_context_data(self, list_, **kwargs):
     if list_ != "":
         if self.request.community_model.name == "coogger":
             queryset = Content.objects.filter(topic__contains=list_,
                                               status="approved")
         else:
             queryset = Content.objects.filter(
                 community=self.request.community_model,
                 topic__contains=list_,
                 status="approved")
         info_of_cards = paginator(self.request, queryset)
         context = super(Userlist, self).get_context_data(**kwargs)
         context["content"] = info_of_cards
         context["nameofhashtag"] = list_
         return context
Esempio n. 10
0
 def get_context_data(self, utopic, username, **kwargs):
     context = super(UserTopic, self).get_context_data(username, **kwargs)
     user = context["content_user"]
     user_queryset = self.ctof(user=user)
     queryset = user_queryset.filter(content_list=utopic, status="approved")
     info_of_cards = paginator(self.request, queryset)
     html_head = dict(
         title=self.title.format(username + " - " + utopic),
         keywords=self.keywords.format(username, utopic, utopic),
         description=self.description.format(username, utopic),
         author=get_facebook(user),
     )
     context["user_follow"] = users_web(user)
     context["head"] = html_head
     context["nameoftopic"] = utopic
     context["content"] = info_of_cards
     return context
Esempio n. 11
0
def notification(request):
    try:
        queryset = Notification.objects.filter(
            user=request.user).order_by("-time")
        hmanynotifications = queryset.filter(show=False).count()
        queryset.update(show=True)
    except:
        ms.error(
            request,
            "Bildirimleri görmeniz için giriş yapın hesabınız yoksa üye olun")
        return HttpResponseRedirect("/")
    pagi = paginator(request, queryset, 10)
    context = dict(
        notifications=pagi,
        paginator=pagi,
        hmanynotifications=hmanynotifications,
    )
    template = "home/notifications.html"
    return render(request, template, context)
Esempio n. 12
0
 def get_context_data(self, username, **kwargs):
     user = User.objects.filter(username=username)[0]
     try:
         OtherInformationOfUsers(user=user).save()
     except:
         pass
     queryset = self.ctof(user=user, status="approved")
     info_of_cards = paginator(self.request, queryset)
     context = super(UserClassBased, self).get_context_data(**kwargs)
     nav_category = []
     for i in queryset:
         c_list = i.content_list
         if c_list not in nav_category:
             nav_category.append(c_list)
     context["content"] = info_of_cards
     context["content_user"] = User.objects.filter(username=username)[0]
     context["user_follow"] = users_web(user)
     context["nav_category"] = nav_category
     context["head"] = self.html_head(username, user)
     context["is_follow"] = is_follow(self.request, user)
     return context
Esempio n. 13
0
 def get_context_data(self, **kwargs):
     context = super(Search, self).get_context_data(**kwargs)
     context["content"] = paginator(self.request, self.get_queryset())
     return context
Esempio n. 14
0
 def get_context_data(self, **kwargs):
     context = super(Draft, self).get_context_data(**kwargs)
     queryset = Content.objects.filter(user=self.request.user, draft=True)
     context["content"] = paginator(self.request, queryset)
     return context
Esempio n. 15
0
 def get_context_data(self, **kwargs):
     context = super(Home, self).get_context_data(**kwargs)
     context["content"] = paginator(self.request, self.queryset)
     return context
Esempio n. 16
0
 def get(self, request, *args,
         **kwargs):  # TODO:  buradaki işlemin daha hızlı olanı vardır ya
     queryset = Content.objects.filter(status="shared")
     info_of_cards = paginator(request, queryset)
     context = dict(content=info_of_cards, )
     return render(request, self.template_name, context)