You are trying "http://127.0.0.1:8000/music//";
try something like
http://127.0.0.1:8000/<int_value>/



Regards,
Amitesh  

    On Saturday, 12 September, 2020, 12:55:57 pm IST, Kunal Solanke 
<kunalsolanke1...@gmail.com> wrote:  
 
 I think he have created the music url,But the {{album_id}} is not properly 
passed as context from view.

On Sat, Sep 12, 2020, 12:52 'Amitesh Sahay' via Django users 
<django-users@googlegroups.com> wrote:

At the first glance, I think you havn't created URL pattern for "music". May 
be....just saying.


Regards,
Amitesh  

    On Saturday, 12 September, 2020, 12:47:56 pm IST, Spyke Lionel 
<ndilion...@gmail.com> wrote:  
 
 I have this urlpatterns..
urlpatterns = [    path('', views.index, name='index'),    
path('<int:album_id>/', views.detail, name='detail'),]
my index.html looks like this
<h1>Albums to display</h1><ul>    {% for album in all_albums %}    <li><a 
href="/music/{{ album_id }}/"> {{ album.album_title }}</a></li>    {% endfor 
%}</ul>#my index.html simply displays my albums. and the above works just fine
my detail.html looks like this
{{ album }}#and it works just fine too
my views.py looks like this
def index(request):    all_albums = Album.objects.all()    return 
render(request, 'music/index.html', {'all_albums': all_albums})
def detail(request, album_id):    try:        album = 
Album.objects.get(pk=album_id)    except Album.DoesNotExist:        raise 
Http404("Album does not exist")    return render(request, 'music/detail.html', 
{'album': album})
#when ever I click on an album link to get the album details, I get the 404 
below:
Page not found (404)Request Method: GETRequest URL: 
http://127.0.0.1:8000/music//
Using the URLconf defined in website.urls, Django tried these URL patterns, in 
this order:1. admin/2. music/ [name='index']3. music/ <int:album_id>/ 
[name='detail']The current path, music//, didn't match any of these.
in my detail funtion in views.py, at first I used on request as an argument and 
it worked just fine to give me the album details (which returned only the album 
id number), but when i added album_id, so as to get the album details, I got an 
error. saying music// not found. Now I don't understand how the last forward 
slash(/) was added.can I get the explaination to this. Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/36d25ae2-7e58-43dc-ad0f-83da9e55e526n%40googlegroups.com.
  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/230500518.1084108.1599895276220%40mail.yahoo.com.



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOecAnyAVZf16m20HGu0KQp8_yrS9kzB8pfkMMyf55Y3tJY0xQ%40mail.gmail.com.
  

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1325467128.1082007.1599895682642%40mail.yahoo.com.

Reply via email to