Page Not Found after much searching

Sorry for the confusion, the show_player is the same concept that I thought would be easy to repeat. That’s why I added it for information. It works. The Rosters screen capture is the one that’s broken. It only work because I removed the link in the HTML. I’m struggling with what information will be useful for your analysis. We are talking about fixing the Rosters () screen capture. When the link under question is added the page won’t render. I get the No Reverse Match error that you mentioned above has nothing to do with the problem.

Ok, so you’ve got two lines on that snippet - I’ll refer to them as “Allen” and “Andersson”.

On each of those lines, you have a button.

Are those “View/Update” buttons supposed to take you to the same page, different pages, or “it depends”?

In any of those three cases, what determines which page each of those buttons is supposed to send you to?

Or, in other words as an example, if “Allen” is supposed to take you to “/roster/15” and “Andersson” is supposed to take you to “/roster/23”, what information in either of those rows identifies which page it’s supposed to send you to?

Or, if all the buttons on that page are supposed to send you to “/roster/27”, what information defines that?

Keep in mind that we are only talking about the tryoutRoster view here. Please do not make any mention of any other model, view, or template that doesn’t not directly relate to this view.

You’re misquoting me here.

The target view has nothing to do with the problem. The fact that you’re adding a link incorrectly to this view is the issue. What the view that that link is supposed to take you to is what’s not relevant.

Not suppose to, they do take the user to a form view of that player where the user can edit the player data and save the changes.

image

def show_player(request, player_id):
  player = Player.objects.get(pk=player_id)
  print(player)
  form = PlayerForm(request.POST or None, instance=player)
  if form.is_valid():
    form.save()
    return redirect('camp_roster')
  return render (request, 'tryouts/show_player.html',
  {'player': player,
  'form': form})

Andersson as you point to is supposed to take the user to tryout roster. Where Andersson is a list of rosters (TryoutRosters).

That’s the question I’m trying to answer. I thought updateTryoutRoster was sending back the id of the roster in the same way that player_id was being used but using the variable tryoutRoster_id. I think what your pointing out is that I need to look closer at how the rendering works. I read what you said about focusing on tryoutRoster only. Does that mean that tryoutRoster should be returning the tryoutRoster_id?

Had to make an exception here because the two screen captures are not connected to the tryoutRoster view. I only want their functionality.

You have the patience of Job. Don’t think for a second that it has gone unnoticed or unappreciated.

But of the three choices I list:

  • Same page
  • Different page
  • It depends

Which one of those three choices identify the desired behavior of those two buttons?

Not just the rendering, but also the logic within your view, the relationships among your data, and the UI/UX of your desired interface.

Again for clarity, when I’m referring to “Allen” and “Andersson” here, I’m referring to the two black buttons that you have indicated here:

The “View/Update” button at the top I’m calling “Allen”. The “View/Update” button on the bottom is what I’m calling “Andersson”

If I click on the black button to the right of “Allen”, it’s supposed to take me to a “page”.

That page is identified by a URL. That URL is associated with a view.

It has been my assumption that the view that is supposed to be referenced here is the view named updateTryoutRoster.

I’m trying to help you identify what parameter you need to supply in that URL. But I’m still not clear on what each button on the lines for “Allen” and “Andersson” are supposed to do.

You’ve now posted:

I don’t understand how this statement fits in with what we’ve described so far.

From your snippet image, “Andersson” is the second name on that list. What does this have to do with a “list of rosters”?

Different page: the id of that roster passed to it from the view.

Allen takes you to player Allen, Andersson takes you to player Andersson. Two different links passed by a view after a function passes back the id. Nothing to do with list of rosters, just an example. I want the same functionality.
A list of rosters is presented to the user. At the end of each row every row has a button. The button takes the user to the roster in that row. Each button has a link to the rosters id. id’s are passed via a view.

Ahh, sorry my mistake.

Note: You’ve got an extra " in the <tbody> tag. Also, your </tbody> tag is inside the loop, not outside it.

So you’re iterating over roster_list, doing “stuff” with each instance of roster

If roster then is an instance of TryoutRoster in roster_list, how would you refer to the primary key of roster?

(Hint: It’s not by using the name tryoutRoster. That name is not defined anywhere within your template or view.)

Removed the quotes and the </tbody tag.

Originally I had intended it to be defined in updateTryoutRoster, but you told me that’s not the problem, correct? Assuming that the problem is still in tryoutRoster, I don’t know what to add there. The id was coming from updateTryoutRoster.
Are you saying that I need to scrap updateTryoutRoster altogether and have tryoutRoster return the id?

Got the id back now. So the page is displaying and when I hover over the button I see the id.
Here’s the change. roster.id, thanks for the hint.

<td>
            <a href="{% url 'updateTryoutRoster' roster.id %}" type="button" class="btn btn-dark btn-sm">View/Update</a>
          </td

Now I get an django.template.exceptions.TemplateDoesNotExist: tryouts/updateTryoutRoster.html error.

Fixed that too. Thanks for all your help.

1 Like