Пример #1
0
    def get(self, request):

        site = RequestSite(request)

        # check if we're doing a query
        url = request.GET.get('q', None)

        if not url:
            podcast = None
            can_add = False

        else:
            try:
                podcast = Podcast.objects.get(urls__url=url)
                can_add = False

            except Podcast.DoesNotExist:
                # check if we could add a podcast for the given URL
                podcast = False
                try:
                    can_add = verify_podcast_url(url)

                except (UpdatePodcastException, NoEpisodesException) as ex:
                    can_add = False
                    messages.error(request, str(ex))

        return render(request, 'missing.html', {
                'site': site,
                'q': url,
                'podcast': podcast,
                'can_add': can_add,
            })
Пример #2
0
    def get(self, request):

        site = RequestSite(request)

        # check if we're doing a query
        url = request.GET.get('q', None)

        if not url:
            podcast = None
            can_add = False

        else:
            try:
                podcast = Podcast.objects.get(urls__url=url)
                can_add = False

            except Podcast.DoesNotExist:
                # check if we could add a podcast for the given URL
                podcast = False
                try:
                    can_add = verify_podcast_url(url)

                except (UpdatePodcastException, NoEpisodesException) as ex:
                    can_add = False
                    messages.error(request, str(ex))

        return render(request, 'missing.html', {
            'site': site,
            'q': url,
            'podcast': podcast,
            'can_add': can_add,
        })
Пример #3
0
    def get(self, request):

        site = RequestSite(request)

        # check if we're doing a query
        url = request.GET.get("q", None)

        if not url:
            podcast = None
            can_add = False

        else:
            try:
                podcast = Podcast.objects.get(urls__url=url)
                if podcast.link is None:
                    raise Podcast.DoesNotExist
                can_add = False

            except Podcast.DoesNotExist:
                # check if we could add a podcast for the given URL
                podcast = False
                try:
                    can_add = verify_podcast_url(url)

                except (UpdatePodcastException, NoEpisodesException) as ex:
                    can_add = False
                    messages.error(request, str(ex))

        return render(
            request,
            "missing.html",
            {
                "site": site,
                "q": url,
                "podcast": podcast,
                "can_add": can_add
            },
        )