#Django-bootstrap4 page rendering problem!

1 messages · Page 1 of 1 (latest)

steep wadi
#

Hi everyone,

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. https://bit.ly/3YLUeEU 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 : https://pastebin.com/RfnpS4yj

My urls.py : https://pastebin.com/8K6Lw63C

my_loans.html: https://pastebin.com/7q6iLUet

my_loans.html: https://pastebin.com/HvsvGrNP - 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. https://github.com/urasayanoglu/board_game_club
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 (https://bit.ly/3WFIvWE) 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

slate holly
#

People won't download a file. Please post the error as text. See #readme-1st

steep wadi
#

I have read the rules before posting that's why I put everything that I wanted to show as links. Otherwise my post would be too crowded to follow. And forgive my ignorance but I dont get your "people wont download a file" advice. They dont need to, everything I used in my post is accessible via browser

slate holly
#

That's fair. I wouldn't consider Google drive isn't an image hosting platform. Regardless, the image preview on my phone is blurry and I'm not downloading a file. Sharing the error message and the simple text formatted stacktrace is more accessible for folks. It looks like a url reverse problem which probably means something is different than the expectation.

upbeat plover
#

The bulk of their error is:

NoReverseMatch at /my_loans
Reverse for 'return_loan' with arguments '(18,)' not found. 1 pattern(s) tried: ['return_loan\\Z']
Raised during board_game_club_apps.views.my_loans
...
<form action={% url 'board_game_club_apps:return_loan' loan.id %} method="post" class="form">