Beispiel #1
0
def user_followeds(request, username):
    user = get_object_or_404(User, username=username)
    followers = Following.get_followeds(user)
    ppform = PhotoForm()
    cpform = CoverPhotoForm()
    search_form = SearchForm(data=request.GET or None)
    if search_form.is_valid():
        arama = search_form.cleaned_data.get("search", None)
        if arama:
            return redirect(
                reverse('pie_thing:index') + '?search={}'.format(arama))
    usero = get_object_or_404(User, username=username)
    activities = UserLog.objects.filter(
        is_active=True, user=usero).order_by("-activity_date")[:5]
    return render(request,
                  "user/followeds.html",
                  context={
                      "activities": activities,
                      "cpform": cpform,
                      "ppform": ppform,
                      "search_form": search_form,
                      "user": user,
                      "followers": followers
                  })
Beispiel #2
0
    def get_followed_list(self):

        followed = Following.get_followeds(self.user)

        return followed.values_list('followed__username', flat=True)