File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11import markdown
2- from django .contrib .auth . models import User
2+ from django .contrib .auth import get_user_model
33from ..settings import (
44 MARTOR_ENABLE_CONFIGS ,
55 MARTOR_MARKDOWN_BASE_MENTION_URL
@@ -23,10 +23,11 @@ class MentionPattern(markdown.inlinepatterns.Pattern):
2323
2424 def handleMatch (self , m ):
2525 username = self .unescape (m .group (2 ))
26+ user_check = get_user_model ().objects .filter (username = username , is_active = True )
2627
2728 """Makesure `username` is registered and actived."""
2829 if MARTOR_ENABLE_CONFIGS ['mention' ] == 'true' :
29- if username in [ u . username for u in User . objects . exclude ( is_active = False )] :
30+ if user_check . exists () :
3031 url = '{0}{1}/' .format (MARTOR_MARKDOWN_BASE_MENTION_URL , username )
3132 el = markdown .util .etree .Element ('a' )
3233 el .set ('href' , url )
You can’t perform that action at this time.
0 commit comments