question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Latest code throws 'unexpected keyword argument parent_page' in django-modelcluster

See original GitHub issue

OK I probably shouldn’t be using the bleeding edge code, but I need some of the 1.4 fixes and features for my project and it was working well before. I’m getting an error with the latest code ever since the commits on Jan 25th to add the new permissions policy. Every time I try to create a new page I get:

Traceback (most recent call last):
  File "/Users/matt/Dev/MyProject/MyApp/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/matt/Dev/MyProject/MyApp/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/matt/Dev/MyProject/MyApp/lib/python3.4/site-packages/django/views/decorators/cache.py", line 43, in _cache_controlled
    response = viewfunc(request, *args, **kw)
  File "/Users/matt/Dev/MyProject/MyApp/lib/python3.4/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/matt/Dev/MyProject/MyApp/MyApp/wagtail/wagtailadmin/views/pages.py", line 169, in create
    parent_page=parent_page)
  File "/Users/matt/Dev/MyProject/MyApp/lib/python3.4/site-packages/modelcluster/forms.py", line 208, in __init__
    super(ClusterForm, self).__init__(data, files, instance=instance, prefix=prefix, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'parent_page'

The old code used to call validate_page_form(form, parent_page) but this has been deleted and replaced by form = form_class(request.POST, request.FILES, instance=page, parent_page=parent_page) along with the offending parent_page.

This looks like an accidental bug (possibly triggered by my page models?) but I don’t understand this part of the code well enough to know how to fix it. Any help appreciated, even if it’s “don’t use the latest code yet”.

Thanks!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
shreddingcommented, Mar 18, 2016

Funny that we all encounter the same problem within minutes. I have the same problem.

I have a working fix, though:

from wagtail.wagtailadmin.forms import WagtailAdminPageForm
from wagtail.wagtailadmin.edit_handlers import TabbedInterface as OriginalTabbedInterface

class TabbedInterface(OriginalTabbedInterface):

    def __init__(self, children, base_form_class=WagtailAdminPageForm):
        super().__init__(children, base_form_class)

-> Use this TabbedInterface instead of the shipped one.

@gasman: can you confirm that this is sufficient or do you see any side effects? AFAIK only the base_form_class must be adjusted.

@everyone: does this work for u as well?

2reactions
tomdysoncommented, Mar 30, 2016

@timheap thanks for this. @kaedroho, can you please review, with the aim of getting it in 1.4.2 in the next few days?

Read more comments on GitHub >

github_iconTop Results From Across the Web

my django view is always throwing "unexpected keyword ...
Short code to reproduce the error: def sample(request): sample(name='') . Now call sample with any value and you'll get the TypeError because ...
Read more >
TypeError: __init__() got an unexpected keyword argument ...
Hi, I have followed the steps given in the chapter to set up mflix app. After completing all the procedure, the following error...
Read more >
#40 (class Aggregate throws "TypeError: __call__() got ... - GENI
class Aggregate throws "TypeError: __call__() got an unexpected keyword argument 'type'" when given any optional argument ...
Read more >
Error gurobipy "__init__() got an unexpected keyword ...
Hi, when i try to run the code in Spyder, this is what it gives me: I cannot understand the error since the...
Read more >
ListFeatureClasses() got an unexpected keyword argument ...
I was able to overcome this problem by simply removing the keyword and just putting "Polygon" in quotes: arcpy.ListFeatureClasses(wildCard ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found