Пример #1
0
 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
Пример #2
0
 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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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)
Пример #6
0
 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)