Пример #1
0
 def get(self, request, pk):
     code_lag=check_lan(request)
     try:
         all_post = AllSongMusic.objects.filter(all_music_auth=pk, is_enable=True, is_delete=False)
         return js_resp_paging(all_post, request, AllSongMusic_Popular_Serializer)
     except User.DoesNotExist:
         return json_resp(code=499, msg=code_lag['499'])
Пример #2
0
 def get(self, request, pk, slug):
     if slug == "singer":
         all_post = AllSongMusic.objects.filter(music_info__singer__id=pk, is_enable=True, is_delete=False)
     else:
         # user = User.objects.get(id=pk)
         all_post = AllSongMusic.objects.filter(music_info_id=pk, is_enable=True, is_delete=False)
     return js_resp_paging(all_post, request, AllSongMusicSearchSerializer)
Пример #3
0
    def get(self, request):
        user = request.user
        current_time = timezone.localtime(timezone.now())
        accessible_time = current_time - datetime.timedelta(days=20)
        objs = AboutyouNotification.objects.filter(
            to_user=user, is_delete=False,
            created_at__gt=accessible_time).order_by('-created_at')

        return js_resp_paging(objs, request, AboutYouNotificationSerializer)
Пример #4
0
 def get(self, request):
     user = request.user
     current_time = timezone.localtime(timezone.now())
     accessible_time = current_time - datetime.timedelta(days=20)
     no_obj = Notification.objects.filter(
         to_user=request.user,
         is_delete=False,
         created_at__gt=accessible_time).order_by('-created_at')
     del_notifactions_count(user.id)
     return js_resp_paging(no_obj, request, InviteSerializer)
Пример #5
0
 def get(self, request):
     user = request.user
     current_time = timezone.localtime(timezone.now())
     accessible_time = current_time - datetime.timedelta(days=20)
     no_obj = FollowerNotification.objects.filter(
         to_user=user, is_delete=False,
         created_at__gt=accessible_time).order_by('-created_at')
     k = "notification_count_{0}".format(request.user.id)
     oth_db.set(k, 0, timeout=None)
     return js_resp_paging(no_obj, request, FollowerNotificationSerializer)
Пример #6
0
 def post(self, request):
     code_lag = check_lan(request)
     slug = self.request.data.get('slug', '')
     word = self.request.data.get('word', "")
     if word:
         if slug == 'song':
             music = self.get_queryset_music(word)
             singer = self.get_queryset_singer(word=word)
             if singer:
                 type = 0
             else:
                 type = 1
             return api_paging(singer=singer, song=music, Serializer_singer=SingerSerializer,
                               Serializer_song=MusicProfileSearchSer, request=request, type=type, return_count=10)
         elif slug == 'people':
             users = self.get_queryset_users(word=word)
             return js_resp_paging(objs=users, request=request, serializer_obj=AccountSerializer, pages=20)
         else:
             return json_resp(code=499, msg=code_lag['499'])
     else:
         return json_resp(code=486, msg=code_lag['486'])
Пример #7
0
    def get(self, request):
        all_category = AllMusicCategory.objects.select_related().filter(is_online=True)

        return js_resp_paging(all_category, request, All_Category_Serializer, pages=20)
Пример #8
0
    def get(self, request):
        all_post = AllSongMusic.objects.filter(is_enable=True, is_delete=False).order_by('-is_recommend_rank')

        return js_resp_paging(all_post, request, AllSongMusicRecommendSerializer, pages=10)
Пример #9
0
 def get(self, request, pk):
     comment = ALLComment.objects.select_related().filter(music=pk)
     return js_resp_paging(comment, request, All_comment_serializer, pages=20)
Пример #10
0
 def get(self, request):
     all_music = AllSongMusic.objects.filter(Q(rank__gt=0), is_delete=False, is_enable=True).order_by('-rank')
     return js_resp_paging(all_music, request, AllSongMusic_Popular_Serializer)
Пример #11
0
    def get(self, request):
        user = request.user
        all_post = AllSongMusic.objects.filter(all_music_auth=user.id, is_delete=False).order_by('-created_at')

        return js_resp_paging(all_post, request, AllSongMusic_Popular_Serializer)