Search code examples
djangodjango-modelsdjango-templatesdjango-urlsquill

Hyperlinks in Django Quill Editor are not displaying as expected


Problem I added the Quill Editor to my Django admin. When I input hyperlinks in the QuillEditor such as "www.example.com", instead of creating the hyperlink exactly as I type it, the URL will appear on the template page as "localhost:8000/plants/www.example.com". Directing me to a broken page instead of www.example.com

Context I've read through the full quill documentation but I don't see a way to make sure hyperlinks added in the QuillEditor display without the project domain being prepended to the front of the hyperlink url.

Heres how I input the URL 'www.example.com' in the django admin:

Here is how the URL appears on the actual template page (you can see the url in the bottom left when I hover over it:

Maybe I need to edit something in the urls.py?

plants > urls.py

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('allauth.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('', include('pages.urls')),
    path('plants/', include('plants.urls')),
]

Solution

  • Change your external links to start with "https://".

    https://www.example.com

    No link

    Yes link