Tuesday, January 31, 2017

I have problem in when submitting song_form

I don't no where i made mistake

DETAIL.HTML


{% extends 'music/base.html'%}
<title>{% block title %}Album detail{%endblock%}</title>
{% block body %}

<div class="container-fulid songs-container">
<div class="row">
<div class="col-sm-4 col-md-3">
<div class="panel panel-default">
<div class="panel-body">
<div class="thumbnail">
<a href="{% url 'music:detail' album.id %}">
{% if album.album_logo %}
<img src="{{album.album_logo.url}}">
{% else %}
<h3>no images to display</h3>
{% endif %}
</a>

<h1>{{album.album_title}}<small>{{album.genre}}</small></h1>
<h3>{{album.artist}}</h3>
<h4>{{album.genre}}</h4>
</div>
</div>
</div>
</div>
<!-- Right song info-->
<div class="col-sm-8 col-md-9">
<ul class="nav nav-pills" style="margin-buttom:10px;">
<li role="presentation" class="active"><a href="#">View All</a></li>
<li role="presentation" class="active"><a href="{% url 'music:song-add' album.id %}">Add new Song</a></li>
</ul>
<div class="panel panel-default">
<div class="panel-body">
<h3>All Songs</h3>

<table class="table">
<thead>
<tr>
<th>Title</th>
<th>Audio File</th>
<th>Favorite</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for song in album.song_set.all%}
<tr>
<td>
{{song.song_title}}
</td>


<td>
<a target="_blank" href="{% url 'music:index'%}">
<button type="button" class="btn btn-success btn-xs">
<span class="glyphicon glyphicon-play"></span>&nbsp; Play
</button>
</a>
</td>


<td>
<a href="" class="btn-favorite"><span class="glyphicon glyphicon-star"></span></a>
</td>
<td>
<form action="{% url 'music:song-delete' album.id %}" method="post" style="display: inline;">
{% csrf_token %}
<input type="hidden" name="song_id" value="" />
<button type="submit" class="btn btn-danger btn-xs">
<span class="glyphicon glyphicon-remove"></span>&nbsp; Delete
</button>
</form>
</td>
</tr>
{% endfor%}</tr>

</tbody>

</table>

</div>
</div>
</div>
</div>
</div>

{% endblock %}

URLS.py


from
django.conf.urls import include, url
from music import views

app_name = 'music'

urlpatterns = [
#this music url
url(r'^$', views.IndexView.as_view(), name='index'),
#registration form
url(r'^register/$', views.UserFormView.as_view(), name='register'),
#this music/detail(album_id)
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
url(r'album/add/$',views.AlbumCreate.as_view(), name='album-add'),
#this music/id/is_favorite
#url(r'^(?P<album_id>[0-9]+)/favorite/$', views.favorite, name='favorite'),
# music/album/2
url(r'^album/(?P<pk>[0-9]+)/$',views.AlbumUpdate.as_view(), name='album-update'),
#music/album/2
url(r'^album/(?P<pk>[0-9]+)/delete/$',views.AlbumDelete.as_view(), name='album-delete'),
#music/album/song/
url(r'^song/add/(?P<album_id>[0-9]+)/$', views.SongCreate.as_view(), name="song-add"),
#music/album/song/
#url(r'^song/(?P<song_id>[0-9]+)/delete/$',views.SongDelete.as_view(), name="song-delete"),
]

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b5b9bb03-4131-40df-8a8d-e1df19f145c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment