Ejemplo n.º 1
0
 def render(self, context):
     try:
         user = template.resolve_variable(self.user, context)
         obj = template.resolve_variable(self.obj, context)
         field = getattr(obj, self.field_name)
     except (template.VariableDoesNotExist, AttributeError):
         return ''
     had_voted = field.get_rating_for_user(user)
     return render_to_string(field.field.widget_template, _rating_widget(obj, field, had_voted), context)
Ejemplo n.º 2
0
 def render(self, context):
     try:
         request = template.resolve_variable(self.request, context)
         obj = template.resolve_variable(self.obj, context)
         field = getattr(obj, self.field_name)
     except (template.VariableDoesNotExist, AttributeError):
         return ''
     had_voted = field.get_rating_for_user(request.user, request.META['REMOTE_ADDR'], request.COOKIES)
     return render_to_string(field.field.widget_template, _rating_widget(obj, field, had_voted), context)
Ejemplo n.º 3
0
 def render(self, context):
     try:
         user = template.resolve_variable(self.user, context)
         obj = template.resolve_variable(self.obj, context)
         field = getattr(obj, self.field_name)
     except (template.VariableDoesNotExist, AttributeError):
         return ''
     had_voted = field.get_rating_for_user(user)
     return render_to_string(field.field.widget_template,
                             _rating_widget(obj, field, had_voted), context)
Ejemplo n.º 4
0
 def render(self, context):
     try:
         request = template.resolve_variable(self.request, context)
         obj = template.resolve_variable(self.obj, context)
         field = getattr(obj, self.field_name)
         widget_template = template.resolve_variable(
             self.widget_template, context
         ) if self.widget_template else field.field.widget_template
     except (template.VariableDoesNotExist, AttributeError):
         return ''
     had_voted = field.get_rating_for_user(request.user,
                                           request.META['REMOTE_ADDR'],
                                           request.COOKIES)
     return render_to_string(widget_template,
                             _rating_widget(obj, field, had_voted), context)