예제 #1
0
    def get_context_data(self):
        self.perform_operations()
        video_host = PiptureSettings.get().VideoHost

        return {
            'MessageURL': '%s/%s' % (video_host, self.video_url),
            'Balance': self.user.Purchaser.Balance,
            'FreeViewersForEpisode': self.free_viewers_for_episode,
        }
예제 #2
0
    def get_context_data(self):
        self.perform_operations()
        video_host = PiptureSettings.get().VideoHost

        return {
            'MessageURL': '%s/%s' % (video_host, self.video_url),
            'Balance': self.user.Purchaser.Balance,
            'FreeViewersForEpisode': self.free_viewers_for_episode,
        }
예제 #3
0
    def get_album_status(cls, album, released, updated):
        user_now = TimeUtils.user_now()

        if not album.episodes.all():
            status = album.STATUS_NORMAL
        elif released > user_now:
            status = album.STATUS_COMING_SOON
        else:
            # TODO: move PiptureSettings from huge models file and remove inline import
            # I use inline import to avoid importing pipture.models in this file
            #from restserver.pipture.models import PiptureSettings

            premiere_days = PiptureSettings.get().PremierePeriod
            premiere_period = timedelta(days=premiere_days)
            if updated >= user_now - premiere_period:
                status = album.STATUS_PREMIERE
            else:
                status = album.STATUS_NORMAL

        return status