def get_infoblock(self, name): request = RequestFactory().get("/") request.user = AnonymousUser() for infoblock in PersonalInfo.get_all(request): if type(infoblock).__name__ == name: value = infoblock break else: value = False return value
def get_infoblock(self, name): request = RequestFactory().get('/') request.user = AnonymousUser() for infoblock in PersonalInfo.get_all(request): if type(infoblock).__name__ == name: value = infoblock break else: value = False return value
def is_active(self): """ The widget is disabled if there are no info blocks at the moment. """ for infoblock in PersonalInfo.get_all(self.request): if infoblock.is_active(): active = super(PersonalInfoWidget, self).is_active() break else: active = False return active
def get_context_data(self, **context): """ Adds the context to the widget. """ return super(PersonalInfoWidget, self).get_context_data(infoblocks=PersonalInfo.get_all(self.request), **context)
def get_context_data(self, **context): """ Adds the context to the widget. """ return super(PersonalInfoWidget, self).get_context_data( infoblocks=PersonalInfo.get_all(self.request), **context)