Skip to content

widgets

django_spire.comment.widgets

TaggingWidget

Bases: Widget

Source code in django_spire/comment/widgets.py
def __init__(self, user_list, *args, **kwargs):
    super().__init__(*args, **kwargs)
    self.user_list = user_list

template_name = 'django_spire/comment/widget/tagging_widget.html' class-attribute instance-attribute

information = None class-attribute instance-attribute

user_list = user_list class-attribute instance-attribute

get_context

Source code in django_spire/comment/widgets.py
def get_context(self, name: str, value, attrs):
    context_data = super().get_context(name, value, attrs)
    context_data['user_list'] = json.dumps(self.user_list)
    # context_data['information'] = self.information
    return context_data

render

Source code in django_spire/comment/widgets.py
def render(self, name: str, value, attrs = None, renderer = None):
    context = self.get_context(name, value, attrs)
    template = loader.get_template(self.template_name).render(context)
    return mark_safe(template)