old_contents: from django import template
  from django.forms import CheckboxInput
  
  
  register = template.Library()
  
  
  @register.filter(name='addclass')
  def addclass(value, arg):
      return value.as_widget(attrs={'class': arg})
  
  
  @register.filter(name='is_checkbox')
  def is_checkbox(field):
      return field.field.widget.__class__.__name__ == \
          CheckboxInput().__class__.__name__
  
new_contents: from django import template
  from django.forms import CheckboxInput
  from django.contrib.auth.models import Group
  
  
  register = template.Library()
  
  
  @register.filter(name='addclass')
  def addclass(value, arg):
      return value.as_widget(attrs={'class': arg})
  
  
  @register.filter(name='is_checkbox')
  def is_checkbox(field):
      return field.field.widget.__class__.__name__ == \
          CheckboxInput().__class__.__name__
  
  
  @register.filter(name='in_group')
  def in_group(user, group_name):
      group = Group.objects.get(name=group_name)
      return True if group in user.groups.all() else False
  
subject: Add templatetag to check if user included in group