Pengin-Open-Source / pengin-pi

PENGIN PI! A CRM with the back bone of a feature light ERP system. Utilitarian in design, easy to extend, customize, and deploy. Made by a community, supported by Tobu Pengin.
GNU General Public License v3.0
9 stars 1 forks source link

[BUG] NameError: name 'get_links' is not defined #349

Closed stuart909 closed 1 year ago

stuart909 commented 1 year ago

Describe the bug when admin tries to create a new blog, the server throws an error because an update was made to the blog system but not all the code meets the new paginate links standard

To Reproduce Steps to reproduce the behavior:

  1. Login as admin
  2. Go to 'http://127.0.0.1/blog/create'

Expected behavior The blog editor should open

Additional details I must have forgotten to update a code in a template or in a route that is still using the old placeholder get_links function. We are no longer using the query.all() method for getting the blog posts. We are using the pagination system and whatever is triggering this needs to be updated to use the new links system.

Error

Traceback (most recent call last):
  File "/home/stuart/.local/lib/python3.11/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/lib/python3.11/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/lib/python3.11/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/lib/python3.11/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/lib/python3.11/site-packages/flask_login/utils.py", line 290, in decorated_view
    return current_app.ensure_sync(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/stuart/.local/lib/python3.11/site-packages/flask_principal.py", line 199, in _decorated
    rv = f(*args, **kw)
         ^^^^^^^^^^^^^^
  File "/media/nfs/workshop/repos/tobuwebflask/app/routes/blog_posts.py", line 69, in create_post
    return render_template('blog/create.html', newPost=1, links=get_links())
                                                                ^^^^^^^^^
NameError: name 'get_links' is not defined
2023-02-03 16:04:21,184 INFO     127.0.0.1 - - [03/Feb/2023 16:04:21] "GET /blog/create HTTP/1.1" 500 -