audio controls doens't appear while pass file from local storage

i want to pass audio file to template html from url. but the audio controls doesn’t work or appear. so please help me to fix this. at my terminal and console, there’s no error message. i was using models to get the file to local storage. i was trying with How to pass Audio file from model to Template in Django? - #3 by Shathamhb but it not works on me. and here’s my code:

{% for record in rec %}

    <audio controls="controls">

           <source src="{{record.audio.url}}" type="audio/mp3">

    </audio>

{ % endfor %}

views.py:

    def mp3_audio(request):
            rec = Audio_store.objects.all()
            return render(request, 'homepage.html' , {'rec': rec }  )

models.py:

from django.db import models
from django.core.files.storage import FileSystemStorage
from django.forms import widgets

fs = FileSystemStorage(location='media/mp3')
fss = FileSystemStorage(location='media/txt')

class Audio_store(models.Model):
    password=models.FileField(storage=fss, null=True)
    audio=models.FileField(storage=fs, null=True)

urls.py:

urlpatterns = [

    url(r'^admin/', admin.site.urls),

    url(r'^decode/$', views.decode),

    url(r'^$', views.homepage),

    path('audio', views.Audio_store),

    path("", views.homepage, name="homepage"), # to call homepage

    path("", views.mp3_audio, name="homepage"),

]

This post is essentially the same as your post at https://forum.djangoproject.com/t/audio-cannot-pass-from-model-to-html/13928

From the page: FAQ - Django Forum

Keep It Tidy

If you have a question, please post it once and don’t make multiple posts in multiple categories to try and get attention. Sometimes it takes a while for the right person to be able to see your post and reply to it!

If you have additional information or clarifications for your original question, you should edit or comment on the original post. It is not appropriate to keep posting this same question multiple times.

it’s different, my audio controls is not shown even if i’m not add source. and i have reference link

All of which would be appropriate edits or comments on the original post.

Or, you could delete your previous question if it is no longer valid, leaving this one as the open question.

i wish if i can delete it, but the one who can delete the post is moderator

Really? On all posts that I’ve made, if I click on the three-dot icon next to “Reply”, I get a trash can icon allowing me to delete my post.


here’s the message when i click trash icon. i just flag it and wait the moderator, it’s just what i can do

Interesting. Then yes, that along with the reason of “Duplicate post - not needed” - or something to that effect is the appropriate solution.

yeah, can you help me? maybe i was wrong with the urls