fusionbox / django-widgy

A CMS framework for Django built on a heterogenous tree editor.
http://wid.gy
Other
332 stars 52 forks source link

Error on inserting a content in Sidebar #353

Open frague59 opened 9 years ago

frague59 commented 9 years ago

Hi,

I'm starting a project with mezzanine + widgy, and I've followed the "first widget" tutorial. I've build a NewsContainer, which will display News, based on rules about categories and publications dates.

Each News is a Content instance, but it is not registered with the @widgy.register decorator : it is administrated elsewhere.

The insertion of my NewsContainer works perfectly when I insert it into the Main content layout container, but it does not when I insert it into the Sidebar container...

I've the following error :

Traceback (most recent call last):
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 63, in __call__
    return self.application(environ, start_response)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 218, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 261, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django_extensions/management/technical_response.py", line 5, in null_technical_500_response
    six.reraise(exc_type, exc_value, tb)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/argonauts/views.py", line 97, in dispatch
    return super(RestView, self).dispatch(*args, **kwargs)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/widgy/views/api.py", line 124, in post
    content = create_content(self.site, content_class)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/widgy/models/base.py", line 611, in add_child
    self.node.add_child(content=obj)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/widgy/models/base.py", line 337, in add_child
    return super(Node, self).add_child(*args, **kwargs)
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/treebeard/mp_tree.py", line 970, in add_child
    return MP_AddChildHandler(self, **kwargs).process()
  File "/home/fguerin/Boulot/workspace/django/intranet/virtualenv/lib/python2.7/site-packages/treebeard/mp_tree.py", line 359, in process
    newobj.path = self.node.get_last_child()._inc_path()
AttributeError: 'NoneType' object has no attribute '_inc_path'

I've tryied to insert other kind of widgets, but I've the same issue.

I've the same issue from main layout editor and from the "Pop out" editor .

Thanks for any help !

gavinwahl commented 9 years ago

Hmm, it looks like the tree structure in the database might be corrupted. Can you open a shell and run:

from widgy.models import Node
Node.find_problems()
Node.find_widgy_problems()
frague59 commented 9 years ago

I've reset the database, and rewinded the project, it looks OK (I'm actually in a realy starting project, so I can do that), but I keep your solution !

Thanks a lot :)