Repository: stephenmcd/mezzanine

Issue #1634: TinyMCE link broken after applying suggested fix - Might be related to generation of URLs
Created: 2016-07-22T11:02:57Z
Hi,
I have been having trouble with the link in TinyMCE. I've read several issues related with this problem and applied the fix suggested on issue #1516 and implemented on commit 94d5729.
I've tried a fresh installation applying the fix and it works on a pristine project but not in mine. The problem persists but it yields different errors.
I'm developing a custom app that is installed along with Mezzanine and django-machina. In my models a few inherit from Displayable and use
objects = SearchableManager()
search_fields = ("title", "description", "keywords")

so content based on these models is searchable (I've followed the documentation on http://mezzanine.jupo.org/docs/search-engine.html)
In this instance the error I get is:

Internal Server Error: /displayable_links.js
Traceback (most recent call last):
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/mezzanine/core/views.py", line 192, in displayable_links_js
for url, obj in Displayable.objects.url_map(for_user=request.user).items():
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/mezzanine/core/managers.py", line 375, in url_map
for item in (model.objects.published(for_user=for_user)
AttributeError: 'SearchableManager' object has no attribute 'published'

If I don't use the search and omit the objects = SearchableManager() from all my classes then the problem appears when it first reads the class django_comments.models.CommentFlag

Internal Server Error: /displayable_links.js
Traceback (most recent call last):
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/angela/Projects/virtualenvs/wuiwatch-mezzanine/lib/python3.4/site-packages/mezzanine/core/views.py", line 200, in displayable_links_js
sorted_links = sorted(links, key=lambda link: (link[0], link[1]['value']))
TypeError: unorderable types: NoneType() < str()

From what I've seen the problem appears when the next for tries to generate the urls for all the content. As soon as it finds a model that gives some problem it crashes.
for model in apps.get_models():
    if issubclass(model, self.model):
        for item in (model.objects.published(for_user=for_user)
                              .filter(**kwargs)
                              .exclude(slug__startswith="http://")
                              .exclude(slug__startswith="https://")):
                items[item.get_absolute_url()] = item

I've commented this block so the users can at least add their own links comfortably and nothing else seems to be broken for now.
I don't know if there's something else I might be missing.
Best!

Duplicate issue #1875: TinyMCE error 500 on displayable links that prevents from creating links
Created: 2018-08-24T02:37:29Z
Hello people,
I'm having an issue with TinyMCE that I can't create links inside the editor. Whenever I attempt to create a link, it throws an Error 500 in console.
I have looked around in Google and found this two links:
#1365
https://stackoverflow.com/questions/2492452/problem-with-insert-update-links-with-tinymce
I used both suggestions but it doesn't work on production, only in localhost.
The project runs Mezzanine 4.2.3, uses Django 1.11 and has HTTPS.
Any suggestions?
Thanks in advance.
Melvin
PD: Posted this on the Mezzanine Google Group

Closing comment (2018-09-18T20:54:04Z): This is already reported in #1634