Skip to content

Commit

Permalink
Squashed merge of task/GH-73-tacc-blockquote-plugin at commit e2d4fc0
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed Jul 30, 2021
1 parent 938db90 commit 62dbc63
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
22 changes: 19 additions & 3 deletions taccsite_cms/contrib/helpers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# Get Django `models.CharField` `choices`
def get_choices(choice_dict):
"""Get a sequence for a Django model field choices from a dictionary.
:param Dict[str, Dict[str, str]] dictionary: choice as key for dictionary of classnames and descriptions
:return: a sequence for django.db.models.CharField.choices
:rtype: List[Tuple[str, str], ...]
"""
choices = []

for key, data in choice_dict.items():
choice = (key, data['description'])
choices.append(choice)

return choices



# Concatenate a list of CSS classes
# SEE: https://github.com/django-cms/djangocms-bootstrap4/blob/master/djangocms_bootstrap4/helpers.py
def concat_classnames(classes):
"""
Concatenates a list of classes (without failing on None)
"""
"""Concatenate a list of classname strings (without failing on None)"""
# SEE: https://stackoverflow.com/a/20271297/11817077
return ' '.join(_class for _class in classes if _class)
2 changes: 1 addition & 1 deletion taccsite_custom
Submodule taccsite_custom updated 0 files

0 comments on commit 62dbc63

Please sign in to comment.