from django import template
from core import CoffeeGrind

def get_grind_display(value):
    return next((v[1] for i, v in enumerate(CoffeeGrind.GRIND_CHOICES) if v[0] == value), None)

register = template.Library()
register.filter('get_grind_display', get_grind_display)
