Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:theonion/django-bulbs into ellipsis
Browse files Browse the repository at this point in the history
  • Loading branch information
MelizzaP committed Jul 14, 2016
2 parents 2810a35 + 553a9c2 commit 5f60029
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## Development

## Version 3.5.1

- Update homepage_player template and pull in entire video object in special coverage context

## Version 3.4.1

- removed `dfp_instant_article`

## Version 3.4.0

- moved share tools for homepage player outside of bulbs-video-meta, this effects styling
Expand Down
2 changes: 1 addition & 1 deletion bulbs/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.4.0"
__version__ = "3.5.1"
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
{# TODO implement /v/2323 redirect route in urls.py #}
{# see: https://trello.com/c/3bT7Xuc9/60 #}
share-url="{% build_video_share_uri video.videohub_ref.id %}"
share-title="{{ video.title }}"
video-url="{{ VIDEOHUB_BASE_URL }}/video/{{ video.videohub_ref.id }}.json"
campaign-url="{% if video.tunic_campaign_id %}{% content_tunic_campaign_url video.tunic_campaign_id %}{% endif %}"
data-track-action="HP: Carousel Item"
Expand Down
2 changes: 0 additions & 2 deletions bulbs/instant_articles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ def get_context_data(self, *args, **kwargs):
context["fire_pageview"] = True
context["platform"] = "Instant Articles"
context["path"] = self.request.GET.get("path", "")
if context["targeting"]:
context["targeting"]["dfp_instant_article"] = True
return context


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1>{{ special_coverage.name }}</h1>
</div>
</div>

{% if video.videohub_ref_id %}
{% if video %}
<bulbs-video-carousel class="video-carousel sc-carousel">
<div class='video-carousel-player sc-video-player'>
<bulbs-video
Expand Down
6 changes: 3 additions & 3 deletions bulbs/special_coverage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from bulbs.special_coverage.models import SpecialCoverage
from bulbs.content.views import BaseContentDetailView
from bulbs.utils.methods import get_video_object
from bulbs.utils.methods import get_video_object_from_videohub_id


class SpecialCoverageView(BaseContentDetailView):
Expand Down Expand Up @@ -33,7 +33,7 @@ def get_context_data(self, *args, **kwargs):
context["targeting"] = {}

try:
context["video"] = get_video_object(self.special_coverage.videos[0])
context["video"] = get_video_object_from_videohub_id(self.special_coverage.videos[0])
except IndexError:
context["video"] = None

Expand All @@ -52,7 +52,7 @@ def get_context_data(self, *args, **kwargs):
if video_id not in self.special_coverage.videos:
raise Http404('Video with id={} not in SpecialCoverage'.format(video_id))

context['video'] = get_video_object(video_id).title
context['video'] = get_video_object_from_videohub_id(video_id)

return context

Expand Down
9 changes: 3 additions & 6 deletions bulbs/utils/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.conf import settings
from django.utils import timezone
from django.apps import apps
from django.shortcuts import get_object_or_404


INVALID_TEMPLATE_CHOICE = """Choices for template values must be non-zero integers."""
Expand Down Expand Up @@ -102,10 +103,6 @@ def get_overridable_template_name(parent_name, child_name):
return template_name


def get_video_object(videohub_id):
def get_video_object_from_videohub_id(videohub_id):
video_model = apps.get_model(settings.VIDEO_MODEL)
try:
video = video_model.objects.get(videohub_ref_id=int(videohub_id))
except:
video = None
return video
return get_object_or_404(video_model, videohub_ref_id=int(videohub_id))
1 change: 0 additions & 1 deletion tests/instant_articles/test_instant_article_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,3 @@ def test_analytics(self):
self.assertEqual(self.content.id, targeting.get("dfp_contentid"))
self.assertEqual(self.content.__class__.__name__.lower(), targeting.get("dfp_pagetype"))
self.assertEqual(self.content.slug, targeting.get("dfp_slug"))
self.assertTrue(targeting.get("dfp_instant_article"))
4 changes: 1 addition & 3 deletions tests/special_coverage/test_spec_cov_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ def test_sets_first_video_to_video(self):
content.__class__.search_objects.refresh()

video = VideohubVideo.objects.create(id=4348)
# model mommy
# import ipdb; ipdb.set_trace()

sc = SpecialCoverage.objects.create(
name="Test Coverage",
Expand All @@ -66,7 +64,7 @@ def test_sets_first_video_to_video(self):
start_date=timezone.now() - timezone.timedelta(days=10),
end_date=timezone.now() + timezone.timedelta(days=10)
)
with patch("bulbs.special_coverage.views.get_video_object") as mock_get_vid:
with patch("bulbs.special_coverage.views.get_video_object_from_videohub_id") as mock_get_vid:
mock_get_vid.return_value = video
response = self.client.get(reverse("special", kwargs={"slug": sc.slug}))
self.assertEqual(response.context['video'], video)
Expand Down

0 comments on commit 5f60029

Please sign in to comment.