There's an open issue for this: https://github.com/stephenmcd/mezzanine/issues/1899
I believe the GitHub version of Mezzanine had the maximum supported Django version changed to 2.0 prematurely, although there's been a ton of compatibility work done and the issue you're looking at is the last known problem with Django 2.0. Once that's resolved we can do a new official release supporting 2.0. I don't have any insight to the cause of the issue nor any immediate availability to look at it myself. On Tue, Nov 13, 2018 at 11:11 AM Mike Schmidt <[email protected]> wrote: > I created a new mezzanine project with the following software versions: > Linux 4.18.17-041817-generic (Ubuntu 18.04 with newer kernel) > MariaDB 10.1.34 (running fine after explicitly creating the database > with utf8 character encoding) > Python 3.6.6 > Django 2.0.9 (from pypi) > Mezzanine 4.3.1 (from github, along with filebrowser-safe) > > The only modifications I've made are changing the timezone in settings.py > and changing the database dictionary in local_settings.py. > > Everything seemed to work. 'python manage.py createdb' was successful, > then 'python manage.py runserver 127.0.0.1:8000' was also successful. > > I logged into the admin interface, navigated to add a new richtext page, > filled in the title and body, and clicked save. A debug-friendly error page > was then returned, and the following text was in the console. > > [12/Nov/2018 14:28:08] "POST /admin/admin_keywords_submit/ HTTP/1.1" > 200 1 > Internal Server Error: /admin/pages/richtextpage/add/ > Traceback (most recent call last): > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/core/handlers/exception.py", > line 35, in inner > response = get_response(request) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/core/handlers/base.py", > line 128, in _get_response > response = self.process_exception_by_middleware(e, request) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/core/handlers/base.py", > line 126, in _get_response > response = wrapped_callback(request, *callback_args, > **callback_kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", > line 575, in wrapper > return self.admin_site.admin_view(view)(*args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/utils/decorators.py", > line 142, in _wrapped_view > response = view_func(request, *args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/views/decorators/cache.py", > line 44, in _wrapped_view_func > response = view_func(request, *args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/sites.py", > line 223, in inner > return view(request, *args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/mezzanine/pages/admin.py", > line 66, in add_view > return super(PageAdmin, self).add_view(request, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", > line 1554, in add_view > return self.changeform_view(request, None, form_url, extra_context) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/utils/decorators.py", > line 62, in _wrapper > return bound_func(*args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/utils/decorators.py", > line 142, in _wrapped_view > response = view_func(request, *args, **kwargs) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/utils/decorators.py", > line 58, in bound_func > return func.__get__(self, type(self))(*args2, **kwargs2) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", > line 1451, in changeform_view > return self._changeform_view(request, object_id, form_url, > extra_context) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", > line 1492, in _changeform_view > self.save_related(request, form, formsets, not add) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/contrib/admin/options.py", > line 1049, in save_related > form.save_m2m() > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/forms/models.py", > line 439, in _save_m2m > f.save_form_data(self.instance, cleaned_data[f.name]) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/mezzanine/generic/fields.py", > line 206, in save_form_data > super(KeywordsField, self).save_form_data(instance, data) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/db/models/fields/__init__.py", > line 838, in save_form_data > setattr(instance, self.name, data) > File > "/home/mike/projects/plab/venv/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", > line 509, in __set__ > % self._get_set_deprecation_msg_params(), > TypeError: Direct assignment to the reverse side of a related set is > prohibited. Use +.set() instead. > [12/Nov/2018 14:28:08] "POST /admin/pages/richtextpage/add/ HTTP/1.1" > 500 146350 > > Attempting to debug this in pycharm, I found that the item being saved was > a 'keyword' of ''. I had not entered any keywords in the form, so it > appears the empty string is saved, anyway. I've read through both django > and mezzanine code in the callstack, and it seems like this is related to > django's database layer and ManyToMany relationships. But it seems the > ultimate saving of the empty keyword is a Field.setattr() call, which is > neither an = or a .set(). And I don't know what the '+' character is from. > > Can anyone help me to understand what needs to be fixed, here? Since I > haven't actually written any code, I'm tempted to think either mezzanine or > django needs a pull request. Or perhaps there's a compatibility issue > between versions of django and mezzanine? I haven't seen anything obvious > in git diffs. But until I understand better, I wouldn't know how to go > about fixing it. I have found a few slightly similar things in this group > and on stackexchange, but nothing that matches. The same behavior occurs if > I run the server and try to add a blog post rather than a richtextpage. And > I get the same behavior on a different server running debian 8 rather than > ubuntu 18. > > Thanks for any advice! > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
