I have started to learn Django framework and I am using Python Crash Course by Eric Matthes as a reference book. I wanted to make sth slightly different than what the book shows but also I have been following mainly the book’s steps. I am trying to make a web site where users can register their board games and borrow them.
I am having a problem when I want to make a user return a board game. I created a form and assign a button that would call the return function. But the page cannot be rendered and here is the error I get. screencapture-127-0-0-1-8000-my-loans-2022-12-23-09_52_15.png - Google Drive I believe the page isn’t being rendered because I am using the form inside the loop and for some reason return_loan doesn’t get a proper loan.id
I have also tried to take my form outside the loop and assign buttons, this time the page was rendered but I couldn’t make the buttons get dynamically the proper id for the loan that would be returned.
Here are the requirements for my django project:
asgiref==3.5.2
beautifulsoup4==4.11.1
Django==4.1.4
django-bootstrap4==22.3
soupsieve==2.3.2.post1
sqlparse==0.4.3
My views.py : views.py - Pastebin.com
My urls.py : urls.py - Pastebin.com
my_loans.html: my_loans.html - Pastebin.com
my_loans.html: my_loans_form_outside_loop.html - Pastebin.com - Here the page is rendered but I couldn’t find a way to get dynamically an id for my loan.
Here is also my github repository for my project. GitHub - urasayanoglu/board_game_club: A web application for loaning board games built in django framework
I haven’t committed and pushed the changes I share above with the pastebin links. So those are not in the repostitory yet.
I’ have been reading the documentation about forms for integrating the bootstrap 4 for django (Welcome to django-bootstrap4’s documentation! — django-bootstrap4 22.3 documentation) and also django documentation for forms but I couldn’t get the solution by myself.
I’d appreciate if you guys could guide me to the right direction.
Thanks in advance,
Uras