from django import template
register=template.Library()

@register.filter
def stringformat(value, fmt='{}'):
   '''
   format the value
   '''
   return fmt.format(value)

from django import template
register=template.Library()

@register.filter
def stringformat(value, fmt='{}'):
   '''
   format the value
   '''
   if isinstance(value, dict):
      return fmt.format(**value)
   return fmt.format(value)

Add named format support if dict
Add named format support if dict

  from django import template
  register=template.Library()
  
  @register.filter
  def stringformat(value, fmt='{}'):
     '''
     format the value
     '''
+    if isinstance(value, dict):
+       return fmt.format(**value)
     return fmt.format(value)
  
Add named format support if dict
## Code Before:
from django import template
register=template.Library()

@register.filter
def stringformat(value, fmt='{}'):
   '''
   format the value
   '''
   return fmt.format(value)

## Instruction:
Add named format support if dict
## Code After:
from django import template
register=template.Library()

@register.filter
def stringformat(value, fmt='{}'):
   '''
   format the value
   '''
   if isinstance(value, dict):
      return fmt.format(**value)
   return fmt.format(value)
