when I click the right button in my slider it moves right but after once moving right its neither moves right nor left

0 votes
Views.py File

def index(request):
    allProds = []
    catprods = Allmusic.objects.values('category', 'sno')
    cats = {item['category'] for item in catprods}
    for cat in cats:
        prod = Allmusic.objects.filter(category=cat)
        n = len(prod)
        nSlides = n // 4 + ceil((n / 4) - (n // 4))
        allProds.append([prod, range(1, nSlides), nSlides])
    params = {'allProds':allProds}
    return render(request,'index.html',params)

HTML File


<div class="container">
        <!--Slideshow starts here -->
        {% for product, range, nSlides in allProds %}
        <h5 class="my-4"><h2 id="headcat1">{{product.0.category}}<h2></h5>
        <div class="row">
            <div id="demo{{forloop.counter}}" class="col carousel slide my-3" data-ride="carousel">
                <ul class="carousel-indicators">
                    <li data-target="#demo{{forloop.counter}}" data-slide-to="0" class="active"></li>
                    {% for i in range %}
                    <li data-target="#demo{{forloop.parentloop.counter}}" data-slide-to="{{i}}"></li>
                    {% endfor %}
                </ul>

                <div class="container carousel-inner no-padding">
                    <div class="carousel-item active">
                        {% for i in product %}
                        <div class="col-xs-3 col-sm-3 col-md-3">
                            <div class="card" style="width: 18rem;">
                                <img src='/media/{{i.image}}' class="card-img-top" alt="...">
                                <div class="card-body">
                                    <h5 class="card-title" id="namepr{{i.id}}"><b>{{i.name}}<b></h5>
                                    <span id="divpr{{i.id}}" class="divpr">
                                        {% if user.is_authenticated %}
                                        <form action="/index/history" method="POST">
                                            {% csrf_token %}
                                            <input type="hidden" name="music_id" value="{{i.sno}}">
                                             <a href="/index/subpage/{{i.sno}}" class="btn btn-primary">Play Music</a>

                                         </form>
                
                                          {% endif %}
                                    </span>
                                </div>
                            </div>
                        </div>
                        {% if forloop.counter|divisibleby:4 and forloop.counter > 0 and not forloop.last %}
                    </div>
                    <div class="carousel-item">
                        {% endif %}
                        {% endfor %}
                    </div>
                </div>
            </div>

            <!-- left and right controls for the slide -->
            <a class="carousel-control-prev" href="#demo{{forloop.counter}}" data-slide="prev">
                <span class="carousel-control-prev-icon"></span>
            </a>
            <a class="carousel-control-next" href="#demo{{forloop.counter}}" data-slide="next">
                <span class="carousel-control-next-icon"></span>
            </a>
        </div>
        {% endfor %}
    </div>



{% endblock body %}
Oct 24, 2020 in HTML by Dhruvil
• 120 points
149 views

Hello @Dhruvil ,

Can you explain me with more details about your error you are facing so that I can help you out

Thank you!!

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In HTML

0 votes
1 answer

How to Identify Web Element( Button) when there are multiple buttons without any ID

Hi Gangadhar, Do you need the HTML code to ...READ MORE

answered Feb 10, 2020 in HTML by Roshni
• 10,440 points
487 views
+1 vote
1 answer

How can i create simple register form using html and css?

Html5 contains lots of elements using which ...READ MORE

answered Jan 31, 2020 in HTML by Niroj
• 82,720 points
2,055 views
0 votes
0 answers

How to do calculation in PHP using a csv file for retrieving data?

Morning, I have a csv file and i ...READ MORE

Feb 11, 2020 in HTML by anonymous
• 140 points
552 views
0 votes
1 answer

How to align a <div> to the middle (horizontally/width) of the page?

Hello Kartik, position: absolute and then top:50% and left:50% places the top edge ...READ MORE

answered Apr 23, 2020 in HTML by Niroj
• 82,720 points
106 views
0 votes
3 answers

HTML - Change\Update page contents without refreshing\reloading the page?

pushState() # The pushState() method let's you update the URL and create ...READ MORE

answered Dec 15, 2020 in HTML by Gitika
• 65,870 points
27,405 views
0 votes
0 answers

I am trying to click the button but it is not working and it is drop list ..

<a class="quickreports btn btn3d tbbtn" href="javascript:" style="position:static" ...READ MORE

Dec 1, 2019 in Python by anonymous
• 120 points
213 views
0 votes
0 answers

@edureka! in my nodejs as its i have used it and pug also but my css doesn't worked as while running localhost it doesn't show styling of css

<!DOCTYPE html><html></html><head><style></style>@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap'); *{ margin: 0; box-sizing: border-box; padding: 0; } #navbar{ background-color:black; padding: 18px ...READ MORE

Jun 10, 2020 in Web Development by anonymous
• 120 points
173 views