Skip to content

Custom the user mentions

agusmakmun edited this page Jul 21, 2021 · 4 revisions

Here we using a custom markdown extensions to handle the user mentions.
If you see this martor/extensions/mention.py extension, you can see below lines:

users = get_user_model().objects.filter(username=username, is_active=True)

The markdown only show if user.is_active, and we using django.contrib.auth.models.User

For other think, this very possible if you want to custom your own extension and including at settings.py

MARTOR_MARKDOWN_EXTENSIONS = [
    ....

    # your custom mention extension
    'path.to.yourmention'
]
Clone this wiki locally