Closed eriktelepovsky closed 6 years ago
I also confirm same error also occurs on frontend in custom form:
class ArticleCreateForm(forms.ModelForm):
content = MarkdownxFormField()
class Meta:
model = Article
fields = ['content']
Issue solved.
Misconfiguration in the urls.py. It seems i18n_patterns are not compatible with the package:
Incorrect:
if 'markdownx' in settings.INSTALLED_APPS:
urlpatterns += i18n_patterns(
url(r'^markdownx/', include('markdownx.urls'))
)
Correct:
if 'markdownx' in settings.INSTALLED_APPS:
urlpatterns += [
url(r'^markdownx/', include('markdownx.urls'))
]
But isn't that what's highlighted in the documentations?
See translations for additional info on locale.
I resolved the error by placing markdownx url include above the ' ' url string.
urlpatterns = [
path('admin/', admin.site.urls),
path('API/', include('backend.urls')),
re_path(r'^markdownx/', include('markdownx.urls')),
# Markdown above the empty url string
path('', include('frontend.urls'))
]
Yeah, @eriktelepovsky was right. In my website, I used i18n
to localize. We need to add the urls outside the i18n_patterns()
Incorrect:
urlpatterns = i18n_patterns(
path("admin/", admin.site.urls),
path("markdownx/", include("markdownx.urls")),
path("rosetta/", include("rosetta.urls")),
...
)
Correct:
urlpatterns = i18n_patterns(
path("admin/", admin.site.urls),
# Translations
path("rosetta/", include("rosetta.urls")),
...
)
urlpatterns += [
path("markdownx/", include("markdownx.urls")),
]
As of this writing in 2024, I could not find relevant documentation. I think it would be a good idea to mention this in the documentation.
Hi. I can't get it work :/ I can see an error at mardownx.js:754:
Any help is appreciated, thank you.
Terminal:
Installed packages:
models.py:
admin.py: