This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
from django.conf import settings | |
register = template.Library() | |
@register.simple_tag(takes_context=True) | |
def absolutize_path(context, *args): | |
relative_url = ''.join(args) | |
absolute_paths = context.get('absolute_paths', False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum, EnumMeta | |
class ChoicesEnumMeta(EnumMeta): | |
def __iter__(self): | |
return ((choice.name, choice.value) for choice in super().__iter__()) | |
class ChoicesEnum(Enum, metaclass=ChoicesEnumMeta): | |
def __str__(self): |