11

Caught KeyError when rendering: 'opts' in the administration interface

 3 years ago
source link: https://www.codesd.com/item/caught-keyerror-when-rendering-opts-in-the-administration-interface.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Caught KeyError when rendering: 'opts' in the administration interface

advertisements

I start to make custom admin view, with custom template. I created template, extended by built-in change_form.html template, form, view and url. I changed {% block form_top %} of orig template in my extended version, passing my form in there. When I view the url of my page, I got an error:

Caught KeyError while rendering: 'opts' in admin interface.

This happens in line 60 of template in {% submit_row %} template tag. Full traceback in there http://dpaste.com/hold/612843/. What is there is not enough? Where to look the lack?

Edit:

{% extends "admin/change_form.html" %}

{% block form_top %}
    {{ form.as_p }}
{% endblock %}

Edit:

def order_cats(request):
    form = OrderCats()
    return direct_to_template(request, 'admin/shivaapp/order_cats.djhtml',
                          {'form': form})


mkriheli is correct, there is something odd with this url being rendered as a change_form rather than a change_list. Apparently you customised the admin view in shivaapp/admin_views.py, but did so incorrectly.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK