Example #1
0
    def get(self, request, pref):
        me = rq.get_me(False, request)

        lk = Q(likes__username=me)
        lv = Q(loves__username=me)

        if pref == 'liked':
            videos = Movie.objects.filter(lk)
            title = 'Videos I like'
        elif pref == 'loved':
            videos = Movie.objects.filter(lv)
            title = 'Videos I love'
        elif pref == 'both':
            videos = Movie.objects.filter(lk | lv)
            title = 'All My Videos'
        elif pref == 'random':
            videos = Movie.objects.filter(lk | lv).order_by('?')
            title = 'All My Videos'
        else:
            # should not happen
            videos = []
            title = 'Error - no video preference'

        vargs = {'movies': videos, 'title': title}
        return vu.generic_collection_view(request, **vargs)
Example #2
0
    def get(self, request, pref):
        me = rq.get_me(False, request)
        lk = Q(likes__username=me)
        lv = Q(loves__username=me)

        if pref == 'liked':
            pictures = Picture.slide_objects.filter(lk)
            title = 'Pictures I Like'
        elif pref == 'loved':
            pictures = Picture.slide_objects.filter(lv)
            title = 'Pictures I Love'
        elif pref == 'both':
            pictures = Picture.slide_objects.filter(lk | lv)
            title = 'All My Pictures'
        elif pref == 'random':
            pictures = Picture.slide_objects.filter(lk | lv).order_by('?')
            title = 'All My Pictures'

        else:
            # should not happen
            pictures = []
            title = 'Error - no picture preference'

        vargs = {'pictures': pictures, 'title': title}
        return vu.generic_collection_view(request, **vargs)
Example #3
0
    def get(self, request, pref):
        me = rq.get_me(False, request)

        lk = Q(likes__username=me)
        lv = Q(loves__username=me)

        if pref == 'liked':
            songs = Song.objects.filter(lk)
            title = 'Songs I like'
        elif pref == 'loved':
            songs = Song.objects.filter(lv)
            title = 'Songs I love'
        elif pref == 'both':
            songs = Song.objects.filter(lv | lk)
            title = 'All my Songs'
        elif pref == 'random':
            songs = Song.objects.filter(lv | lk).order_by('?')
            title = 'My Songs Radio'
        else:
            # should not happen
            songs = []
            title = 'Error - no song preference'

        vargs = {'songs': songs, 'title': title}
        return vu.generic_collection_view(request, **vargs)
Example #4
0
    def get(self, request, slug):
        """ display movie list using common collection view """
        director = get_object_or_404(models.Director, slug__iexact=slug)

        vargs = {
            'movies': director.movies.all(),
            'title': ('Movies directed by %s' % director.fullName)
        }
        return vu.generic_collection_view(request, **vargs)
Example #5
0
def transfer_favourites(request):
    me = rq.get_me(True, request)

    lk = Q(likes__username=me)
    lv = Q(loves__username=me)
    songs = Song.objects.filter(lv | lk)
    my_path = rutils.transfer_to_my_directory(me, songs)

    title = 'Transferred to directory ' + my_path
    vargs = {'songs': songs, 'title': title}
    return vu.generic_collection_view(request, **vargs)
Example #6
0
    def get(self, request):
        #print("CachedFileList GET")

        mycache = cu.MyCache(request)

        songs, pictures, videos, _ = mycache.get_query()

        vargs = {
            'songs': songs,
            'pictures': pictures,
            'movies': videos,
            'title': 'Saved Collection'
        }
        return vu.generic_collection_view(request, **vargs)
Example #7
0
    def get(self, request, slug):
        """
        Given the slug, find the corresponding tag and
        collect object lists to pass to the collection view
        """
        #print("TagDetailView GET")
        tag = get_object_or_404(models.Tag, slug__iexact=slug)

        vargs = {
            'songs': tag.song_tags.all(),
            'pictures': tag.picture_tags.all(),
            'movies': tag.movie_tags.all(),
            'title': tag.name
        }
        return vu.generic_collection_view(request, **vargs)
Example #8
0
    def get(self, request, slug):
        """
        collect the information to pass to the common collection view
        """
        target = get_object_or_404(models.Collection, slug__iexact=slug)

        artists = target.album_musicians.all()
        if artists.count():
            songs = target.songs.all().order_by('track')
        else:
            songs = target.songs.all()

        vargs = {
            'songs': songs,
            'pictures': target.pictures.all(),
            'movies': target.movies.all(),
            'artists': artists,
            'title': target.title,
            'update': target
        }

        return vu.generic_collection_view(request, **vargs)
Example #9
0
 def get(self, request, kind, myorder):
     """
     passes kind and ordering to the common collection view
     """
     vargs = {'kind': kind, 'myorder': myorder}
     return vu.generic_collection_view(request, **vargs)