def get_context_data(self, *args, **kwargs): context = ListView.get_context_data(self, *args, **kwargs) context.update(BaseView.get_context_data(self, *args, **kwargs)) context["social"] = Social.all_as_dict() news = Content.objects.filter(slug="noticias") if news.exists(): context["content"] = news[0] return context
def test_should_return_a_dictionary_when_call_call_as_dict(self): twitter = Social.objects.create(social_networking="twitter", profile="flaviamissi") social_dict = Social.all_as_dict() twitter.delete() self.assertEqual("flaviamissi", social_dict["twitter"])
def get_context_data(self, *args, **kwargs): context = {} context['content_list'] = self.model.objects.all().values("title") context["social"] = Social.all_as_dict() return context