код class Gkno(db.Model):
tablename = ‘gkno’
id_gkno = db.Column(db.Integer, primary_key=True)
code_gkno = db.Column(db.Integer)
nasvanie_gkno = db.Column(db.String(255))


class Vodoem(db.Model):
tablename = ‘vodoem’
id_vodoem = db.Column(db.Integer, primary_key=True)
code_vodoem = db.Column(db.Integer)
nasvanie_vodoem = db.Column(db.String(255))
tip_vodoem_id = db.Column(db.Integer)
tip_vodoem_code = db.Column(db.Integer)
tip_vodoem_nasvanie = db.Column(db.String(255))

gkno_id = db.Column(db.Integer, db.ForeignKey(‘gkno.id_gkno’))
#gkno = db.relationship(‘Gkno’, backref=‘vodoems’)
gkno_nasvanie = db.relationship(‘Gkno’, backref=‘vodoems’)

gkno_code = db.Column(db.Integer)
#gkno_nasvanie = db.Column(db.String(255))

class MyModelView(ModelView):
def edit_view(self, *args, **kwargs):
return super().edit_view(self, *args, **kwargs)



#class VodoemModelView(ModelView):
page_size = 50


form_overrides = {
‘gkno_nasvanie’: SelectField
}

form_args = {
‘gkno_nasvanie’: {
‘widget’: Select2Widget(),
‘get_label’: ‘nasvanie_gkno’
}
}

form_ajax_refs = {
‘gkno_nasvanie’: {
‘fields’: [‘nasvanie_gkno’]
}
}




#admin.add_view(VodoemModelView(Vodoem, db.session, endpoint=‘vodoem’))
admin.add_view(MyModelView(Vodoem, db.session, endpoint=‘vodoem’)) вызывает ошибку Traceback (most recent call last):
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 2529, in wsgi_app
response = self.full_dispatch_request()
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 1823, in full_dispatch_request
rv = self.dispatch_request()
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\base.py”, line 69, in inner
return self._run_view(f, *args, **kwargs)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\base.py”, line 369, in _run_view
return fn(self, *args, **kwargs)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\model\base.py”, line 2029, in index_view
return self.render(
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\base.py”, line 308, in render
return render_template(template, **kwargs)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\templating.py”, line 147, in render_template
return _render(app, template, context)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\templating.py”, line 130, in _render
rv = template.render(context)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\jinja2\environment.py”, line 1301, in render
self.environment.handle_exception()
File “C:\WEB\flask-admin-test\venv\lib\site-packages\jinja2\environment.py”, line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 6, in top-level template code
{% import ‘admin/model/row_actions.html’ as row_actions with context %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\master.html”, line 1, in top-level template code
{% extends admin_base_template %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\base.html”, line 38, in top-level template code
{% block page_body %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\base.html”, line 78, in block ‘page_body’
{% block body %}{% endblock %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 68, in block ‘body’
{% block model_list_table %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 116, in block ‘model_list_table’
{% block list_row scoped %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 122, in block ‘list_row’
{% block list_row_actions_column scoped %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 125, in block ‘list_row_actions_column’
{% block list_row_actions scoped %}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\list.html”, line 127, in block ‘list_row_actions’
{{ action.render_ctx(get_pk_value(row), row) }}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\model\template.py”, line 14, in render_ctx
return self.render(context, row_id, row)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\model\template.py”, line 72, in render
return m(self, row_id, row)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\jinja2\runtime.py”, line 777, in _invoke
rv = self._func(*arguments)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\templates\bootstrap3\admin\model\row_actions.html”, line 18, in template
{{ link(action, get_url(‘.edit_view’, id=row_id, url=return_url), ‘fa fa-pencil glyphicon glyphicon-pencil’) }}
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask_admin\base.py”, line 393, in get_url
return url_for(endpoint, **kwargs)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\helpers.py”, line 256, in url_for
return current_app.url_for(
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 2034, in url_for
return self.handle_url_build_error(error, endpoint, values)
File “C:\WEB\flask-admin-test\venv\lib\site-packages\flask\app.py”, line 2023, in url_for
rv = url_adapter.build( # type: ignore[union-attr]
File “C:\WEB\flask-admin-test\venv\lib\site-packages\werkzeug\routing\map.py”, line 947, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.exceptions.BuildError: Could not build url for endpoint ‘vodoem.edit_view’ with values [‘id’, ‘url’]. Did you mean ‘vodoem.create_view’ instead?
127.0.0.1 - - [18/Jun/2023 13:39:15] “GET /admin/vodoem/ HTTP/1.1” 500 - как исправить пример кода