Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Error while sending a file using FormData Ajax Django
I have been trying to load a multiple file HTML input using Ajax and Django, I know that there are a bunch of questions related to this problem here in StackOverflow but none of the methods have worked for me. I am trying to use a single web page. I would appreciate any recommendation: HTML Code: This code is inserted also with a click function using ajax, that is why there are a lot of + symbols and everything is inside quotation marks +'<form id="reclamo" action="{% url "denuncia" %}" method="post" enctype="multiport/form-data">' +'{% csrf_token %}'+'<label for="files">Adjuntos:</label>'+'<b>&nbsp;&nbsp;</b>' +'<input type="file" id="files" name="files" multiple><br><br>' +'<input type="submit" name="upload" value="Reportar">' +"</form>" And this one is the Ajax code: $(document).on('submit','#reclamo',function(e) { e.preventDefault(); var frm = new FormData($('#reclamo').get(0)); $.ajax({ url: "/denuncia/", type: "POST", data: frm, cache:false, proccessData: false, contentType: false, headers:{ 'X-CSRFToken':'{{csrf_token}}' }, success: function(result){ if (result == 'saved') { alert('ha sido creada con exito') } } }); }) The error I am getting is: Uncaught TypeError: Illegal invocation at e (jquery-3.1.1.min.js:4) at xb (jquery-3.1.1.min.js:4) at Function.r.param (jquery-3.1.1.min.js:4) at Function.ajax (jquery-3.1.1.min.js:4) at HTMLFormElement.<anonymous> ((index):226) at HTMLDocument.dispatch (jquery-3.1.1.min.js:3) at HTMLDocument.q.handle (jquery-3.1.1.min.js:3) -
django / AttributeError: 'list' object has no attribute 'update' - Update record in database
I am newbie in django . Need to update database records with values . two queryset populate with filter and database list function and merged both of them in list now i want to update database with emp id and emp name also display result in given html file with updated record database . I am getting below error while trying to update database with merged queryset result in list . AttributeError: 'list' object has no attribute 'update' views.py django.shortcuts import render from django.shortcuts import redirect from .forms import requestrecord from .models import storetest from django.db import transaction from itertools import chain def requestdetail(request): if request.method == "POST": formrequest = requestrecord(request.POST) if formrequest.is_valid(): feid = formrequest.cleaned_data['EID'] femp_name = formrequest.cleaned_data['EMP_NAME'] fstate = formrequest.cleaned_data['STATE'] fstore_count = formrequest.cleaned_data['No_Of_Store_id_Assigned'] data = [] data1 = [] data2 = [] if fstate == "AAA": data1 = storetest.objects.filter(STATE=fstate).filter(CITY='AAADDD')[:fstore_count] data2 = storetest.objects.filter(STATE=fstate).filter(CITY='AAAEEE')[:fstore_count] data = list(chain(data1, data2)) data = data.update(EID=feid, EMP_NAME=femp_name) data.save() elif fstate == "BBB": data1 = storetest.objects.filter(STATE=fstate).filter(CITY='BBBFFF')[:fstore_count] data2 = storetest.objects.filter(STATE=fstate).filter(CITY='BBBGGG')[:fstore_count] data = list(chain(data1, data2)) data = data.update(EID=feid, EMP_NAME=femp_name) data.save() else: "No Selection" print(data) print(fpid) print(fproj_name) print(fcountry_did_request) print(fstore_count) #formtorequest.save() formrequest = requestrecord() else: formrequest = requestrecord() return render(request,'Request-Record.html',{'form':formrequest}) -
where File-based Sessions `s file store on system file?
whene use SESSION_ENGINE = "django.contrib.sessions.backends.file" as backend where sessions file created -
Why am I getting a KeyError: 'scheduler' when trying to run a celery beat?
I am using celery in Django to periodically schedule tasks. Here are the files: tasks.py @periodic_task(run_every=(timedelta(minutes=1))) def query(): ... celery.py from __future__ import absolute_import, unicode_literals from os import environ, path from celery import Celery from django.conf import settings PROJECT_NAME = path.basename(path.dirname(__file__)) environ.setdefault('DJANGO_SETTINGS_MODULE', '%s.settings' % PROJECT_NAME) app = Celery(PROJECT_NAME) app.config_from_object('django.conf:settings') app.autodiscover_tasks(lambda: settings.INSTALLED_APPS) When I run celery -A project worker to start the worker, that executes fine. However, when I run celery -A project beat to start the beat scheduler, I get the following error: KeyError: 'scheduler' Why would this be occurring? I am using vagrant in PyCharm and accessing the server through vagrant ssh. -
Django: How to Auto-Populate a field with another two field's value in same model
I and want to auto populate the tags field in my Django model with the value of the category & subcategory. i tried to find solutions but most of the answer leads to (auto populate from another model). But i want to auto populate it with value of two or more fields in same model. from django.db import models from .category import cat, sub_cat # Create your models here. class Product(models.Model): product_id = models.AutoField(primary_key=True) product_name = models.CharField(max_length=200) category = models.CharField( max_length=50, choices=cat(), default="") subcategory = models.CharField( max_length=50, choices=sub_cat(), default="") brand = models.CharField(max_length=50, default="") desc = models.TextField(max_length=1500) price = models.FloatField(default=0) pub_date = models.DateField() image = models.ImageField(upload_to="shop/images", default="") tags = -
What is the difference between passing and not passing user as argument in authenticate method in Django?
user = authenticate(request, username=username, password) And user = authenticate(username=username, password=password) I have to save a user but I want to authenticate it first so I am getting a user object by form.save(commit=False) method. -
Jquery looping through Django context object
I have a data list in Html. from django views.py as tag (Mydata). and In the html page I want to loop through that list using Jquery i tried some method but it didn't work this is my view def weltestprd(request, WeelN): MyData=TestPRODM.objects.filter(WellID__exact=WeelN) context={ 'MyData':MyData, } return render(request,'Home/Prodtest.html',context) and this is my html page and the loop works fine. {% for Values in MyData %} <p>{{Values.Id}}</p> <p>{{Values.Name}}</p> <p>{{Values.Prod}}</p> <!-- decimal number--> {% endfor %} and I want to see the same result in consol using jquery I tried this but didn't work by the way I have (string and decimal number in my list) {% block custom_js %} <script > var my_dataLoop = ("{{ MyData }}") console.log(my_dataLoop) $.each(my_dataLoop, function(key, value) { console.log(value); }) </script> {% endblock custom_js %} the console.log(my_dataLoop) shows me this list without numbers? &lt;QuerySet [&lt;TestPRODM: TFT2&gt;, &lt;TestPRODM: TFT2&gt;]&gt; -
How to search through rows and assign column value based on search in Postgres?
I'm creating an application similar to Twitter. In that I'm writing a query for the profile page. So when the user visits someone other users profile, he/she can view the tweets liked by that particular user. So for that my query is retrieving all such tweets liked by that user, along with total likes and comments on that tweet. But an additional parameter I require is whether the current user has liked any of those tweets, and if yes, I want it to retrieve it as boolean True in my query so I can display it as liked in UI. But I don't know how to achieve this part. Following is a sub-query from my main query select l.tweet_id, count(*) as total_likes, <insert here> as current_user_liked from api_likes as l INNER JOIN accounts_user ON l.liked_by_id = accounts_user.id group by tweet_id Is there an inbuilt function in postgres that can scan through the filtered rows and check whether current user id is present in liked_by_id. If so mark current_user_liked as True, else False. -
How do I turn off auto-update on static files? in django (python)
I want change css. when i change continer height for oncklick function, after 1 second returns the same size, and when i have error console refresh in 1 second and i can't see. how fix? i turn off livereload plugin.It refreshes everything in 1 second. when i delete {% now "U" %} to css link rel after css is crashed and not work why? this is problem? this is my codee---> base.html <!DOCTYPE HTML> <html> <head> <title>home</title> </head> <link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" /> <body> {% block content %} {% endblock %} <script src="/static/js/homescript.js"></script> </body> </html> home.html {% extends 'base.html' %} <link rel="stylesheet" type="text/css" href="/static/css/style.css?{% now "U" %}" /> {% block content %} <form action = '' method="post" novalidate="novalidate"> {% csrf_token %} <div class="continer"> {% for field in form %} {{ field.label_tag }} {{ field }} {{ field.errors }} {% endfor %} <input type="submit" name="register" id="btn" onClick = "document.querySelector('.continer').style.height = '200px';"> </div> </form> {% endblock %} style.css @import url("//cdn.web-fonts.ge/fonts/bpg-glaho-arial/css/bpg-glaho-arial.min.css"); html,body{ background-image: url("../img/test.jpg") ; background-position: center center; background-size: 100% 100%; background-repeat: no-repeat; background-attachment: fixed; padding: 0; margin: 0; } .continer { position: absolute; width: 300px; height:400px; background-color: blue; } .inp{ margin: 3px; margin-left: 57px; width: 180px; height: 20px; border-radius: … -
How to add a display name that contain spaces in django?
I wanted the users to have username that allow spaces, but I came to know that this method will result in many issues, so I decided to go with a display name that have nothing to do with the username, but before knowing how to do this, I want to know if this method will be completely problem free, secondly, I thought of an approach to this and I want to know your opinion and If there is a better way to do it. I will create a profile model, which will contain the user's image and also the display name, so the user will create his account and then he will be redirected to set his profile image and his display name(that accepts spaces). If there is any flaws in the method I mentioned please let me know, and if possible suggest a better login for this. And If the display name will result in any issues please let me know. Thanks in advance. -
Django - stop form text area from autopopulating
I am making a login form with Django, but after I add a password input widget to my loginForm, the form text autopopulates with the first user in my database (See image below). This happens after I refresh or submit the form. I want the username and password fields to be blank. Image forms.py: class loginForm(ModelForm): class Meta: model = User fields = ['username', 'password'] widgets = {'password': forms.PasswordInput()} views.py: def loginview(request): if request.method == 'POST': form = loginForm(request.POST) username = request.POST['username'] password = request.POST['password'] user = authenticate(request, username=username, password=password) if user is not None: return HttpResponse('<html> Thanks </html>') else: form = loginForm() else: form = loginForm() return render(request, 'login.html', {'form':form}) login.html: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> </head> <body> <form class="" action="" method="post"> <div class="field"> {{ form.username.label_tag }} {{ form.username }} </div> <div class="field"> {{ form.password.label_tag }} {{ form.password }} </div> {% csrf_token %} <input type="submit" value="Login to Your Grocerylist Account "> </form> </body> </html> -
Django how urls.py how to add url / problem in adding url
i created my first app in Django. and when i am running it in my chrome browser using the url http://127.0.0.1:8000/hello It didn't open but when i used the url:- http://127.0.0.1:8000/ It worked, don't know why. I added the url in urls.py file. like this. path('hello', views.hello_world_view, name='hello') suggest me where i am going wrong. Thanks -
page does not redirect to an error page in django
The page doesn't redirect to an error page if the value is less than the current bid and doesn't update the bid if the user add another one. views.py: def add_bid(request, id): username = request.user.username # get username item = Auction_listings.objects.get(pk=id) try: bid_value = float(Bids.objects.get(auction=id).bid_value) except: bid_value = float(item.product_price) if request.method == "POST": new_bid_value = float(request.POST.get("bid")) if new_bid_value > bid_value: new_bid = Bids(auction=item, username=username, bid_value=bid_value) new_bid.save() else: return render(request, "auctions/error.html", { "error": "your bid is lower than the current bid..." }) models.py: class Auction_listings(models.Model): product_image = models.CharField(max_length=500) product_title = models.CharField(max_length=40) product_description = models.CharField(max_length=1000) product_category = models.CharField(max_length=30, default="others") product_price = models.DecimalField(max_digits=10, decimal_places=2) is_closed = models.BooleanField(default=False) winner = models.CharField(max_length=40, blank=True) username = models.CharField(max_length=40) post_date = models.DateTimeField(default=django.utils.timezone.now, verbose_name='posted date') def __str__(self): return f"{self.product_title}" class Bids(models.Model): auction = models.ForeignKey(Auction_listings, on_delete=models.CASCADE) username = models.CharField(max_length=64) bid_value = models.DecimalField(max_digits=10, decimal_places=2) def __str__(self): return f"{self.bid_value} by {self.username} in {self.auction}" thank you in advanced! -
Python 3.x sending POST request, GET request being sent
Im trying to make an API call, using requests in python but the status returns GET Request not allowed. Using Django 3.3.0, DRF, Postgres. Serializers are standard, nothing fancy also all API's are POST @api_view(['POST']) REQUEST : @csrf_exempt @api_view(['POST']) def DroidDump(request): data = request.data for d in data: response = requests.post('http://13.232.239.102/api/AddPatient',data = d) return Response(response) return Response(status=201) API FOR REQUEST: @api_view(['POST']) def AddPatient(request): serializer = PatientSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) return Response(serializer.errors) POSTMAN RETURN: [ "{\"detail\":\"Method \\\"GET\\\" not allowed.\"}" ] JSON SENT: [ { "pkid": "0000", "name": "Shlok", "surname": "Parida", "relation": "son of", "gaurdian_name": "xyz parida", "age": "20", "gender": "M", "phone": "9876543210", "adhaar": "123456789123", "village":"12", "maritalstatus": "unmarried", "bloodgroup": "B+", "PVGT": "no", "deworming":"yes", "dateoftesting": "2020-04-01", "serumCreatinine": "2.5", "bloodUrea": "3.4", "uricAcid": "6.3", "electrolytes_sodium": "2.3", "electrolytes_potassium": "5.4", "bun": "9.2", "pedalEdema": "", "pedaltype": "", "kidneystatus": "", "ailments": "", "dialysis": "False", "doctorreq": "False", "hospitalAdmit": "", "dateOfAdmit": "2020-04-02", "refered": "False", "referredto": "", "status": "", "treatmentDone": "", "discharge": "2020-04-02", "dischargeStatus": "", "deceased": "False", "deathDate": "2020-07-15", "placeOfDeath": "", "causeOfDeath": "" } ] -
I Can't Update Table In Python Django and Its Not Showing Any Error
I have a Users table that have null able column. I did tried lot's of way to update a single column. but its not update the column with any error(Its not showing any error), Debug is On. The Code below instance = Users.objects.get(username="user1") instance.left = "A string" #CharField instance.save() Another Way instance = Users.objects.filter(username="user1").update(left="A string") But all are not updating the column But In the shell (python manage.py shell) all method are working that i describe before. -
Django ORM SQL Explanination
Django Query Device.objects.filter(ticket__isnull=True) SQL OUTPUT SELECT "devices_device"."id", "devices_device"."created_at", "devices_device"."updated_at", "devices_device"."guid", "devices_device"."is_deleted", "devices_device"."deleted_at", "devices_device"."created_by_id", "devices_device"."last_modified_by_id", "devices_device"."version", "devices_device"."serial_number", "devices_device"."alternate_device_id", "devices_device"."product_name", "devices_device"."configuration" FROM "devices_device" LEFT OUTER JOIN "tickets_ticket" ON ("devices_device"."id" = "tickets_ticket"."device_id") WHERE ("devices_device"."is_deleted" = false AND **"tickets_ticket"."id" IS NULL**) why where clause has "tickets_ticket"."id" IS NULL? -
How to block reservation if model exists
I want to filter all the reservations by their check ins and check outs but I'm not sure how to do it. I'm going to check if self.check_in is greater than equal or less than (not equal) all check_ins related with self.room and self.check_out is greater than (not equal) or less than equal all check_outs also related with. I know all the methods etc. but I have any idea how to write it correctly. from datetime import date from django.db import models from django.core.exceptions import ValidationError class Reservation(models.Model): room = models.ForeignKey('management.Room', related_name='reservations', on_delete=models.CASCADE) guest = models.ForeignKey('reservations.Guest', related_name='reservations', on_delete=models.CASCADE) check_in = models.DateField() check_out = models.DateField() made_by = models.ForeignKey('management.Employee', related_name='reservations', on_delete=models.SET_NULL, null=True) class Meta: unique_together = (('room', 'guest', 'check_in'), ('room', 'guest', 'check_out'),) ordering = ('check_out',) def clean(self): super().clean() if self.check_in < date.today() or self.check_out < date.today(): raise ValidationError('Date cannot be in the past.') if self.check_in >= self.check_out: raise ValidationError('Reservation must last at least one day.') def __str__(self): return f'Reservation for {self.guest.first_name} \ {self.guest.last_name} - Room {self.room.number}' -
Django and Printful Integration
I'm a Jr Python/Django developer, and I'm starting Django E-commerce project, using print on demand Printful tools, I will use the Printfull API. Some of you can tell me where I can find more information about this integration? Thank you. Flavio -
Why my fixture is not installing on django project?
I created a backup of database using fixtures in my django project by following command:- python manage.py dumpdata > db.json when i load the fixture, i get following error:- django.db.utils.IntegrityError: Problem installing fixture '/home/gagan/saporawebapp/webapp/fixtures/db.json': Could not load contenttypes.ContentType(pk=17): duplicate key value violates unique constraint "django_content_type_app_label_model_76bd3d3b_uniq" DETAIL: Key (app_label, model)=(webapp, homescreen) already exists. I don't know how integrity erros arises even when i'm just loading the fixture. How can i solve this error? -
Django - Does not load statics files
I am using Django 3.0.8 and like many, I have problems with static files, I have tried many of the recommendations that were previously published but no success. What I don't understand is that the settings I made, I tried in a Linux environment (Raspbian) and everything works correctly, but when I try on windows 10 with the same settings, same Django version and all, the static files are not loaded, specifically the "css" and "js" files, because images perfectly load so I do not understand why. Any help I will be very grateful! This is my settings.py file: BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR + '/templates/'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] STATIC_URL = '/static/' STATICFILES_DIRS = [ os.path.join(BASE_DIR,'static'), ] base.html : {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="iso-8859-1"/> <!--determina si tiene caracter chino,etc--> <meta charset="utf-8" /> <!-- Bootstrap --> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="stylesheet" href="{% static 'Bootstrap-Files/css/bootstrap.min.css'%}"> <link rel="stylesheet" href="{% static 'css/base.css'%}"/> <title>{% block title %}TIMING ADVANCE TA{% endblock %}</title> </head> <body> {% block body_section %} {% endblock %} <script type="text/javascript" src="{% static 'Bootstrap-Files/jquery-3.5.1.js'%}"></script> <script src="{% static 'Bootstrap-Files/js/bootstrap.min.js'%}"></script> </body> … -
KeyError at /project/
i want to convert my data of json type but i received this error please where is it my error in my code views.py : class GetDroplets(TemplateView): template_name = 'blog/home.html' def get_context_data(self, *args, **kwargs): context = { 'droplets' : get_droplets(), } return context service.py : def get_droplets(): headers = {'Content-type': 'application/json', 'PRIVATE-TOKEN': '', 'Authorization': '' } url='http://172.16.0.111/api/v4/projects/' url_redmine='http://172.16.0.112:3000/projects.json/' r = requests.get(url, headers=headers) r = requests.get(url_r, headers = {'Authorization': 'Basic =='}) droplets = r.json() print(droplets) droplet_list = [] for i in range(len(droplets)): droplet_list.append(droplets[i]) return droplet_list return JsonResponse({'droplets':droplets}, content_type='application/json') from the line print (droplets) it displays at the end all my data of the json type but in fact the prombleme and display my data which I retrieve in the table ,and I received two errors in the terminal services.py, in get_droplets droplet_list.append(droplets[i]) KeyError: 0 views.py", line 136, in get_context_data 'droplets' : get_droplets(), -
Django Rest - Remote login AJAX request from desktop app WORKS but does not keep user logged In (cookie not saved?)
I have set up a View that handles login requests which I'm acessing through AJAX from BOTH : Browser, A Dekstop App (with electron if that matters) class UserLoginSerializerView(mixins.CreateModelMixin,viewsets.GenericViewSet): queryset = repository.objects.all() serializer_class = UserSerializer def create(self, request, *args, **kwargs): print(get_client_ip(request)) if (not request.user.is_authenticated): username = request.POST.get("username") password = request.POST.get("password") user = auth.authenticate(username=username,password=password) if user is not None: auth.login(request,user,backend="django.contrib.auth.backends.RemoteUserBackend") #### ----------- NOTE : IF backend IS SPECIFIED THE COOKIE IS NOT KEPT ON THE BROWSER --######## ################################################################################################# ################################################################################################# ################################################################################################# return Response({"sucess" : f'User {username} successfully logged in'}) else: return Response({"error" : f'Invalid Credidentials'}) else: return Response({"info" : f'User {request.user.username} is already authenticated'}) The JSON response works FINE and returns the right response in both cases (request from browser,request from dekstop app) The thing is : When it is accessed from the Dekstop APP it throws away the information and does not save a cookie This does not happen when accessed through the browser I've followed the steps stated in the Documentation : settings.py AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.RemoteUserBackend', 'django.contrib.auth.backends.ModelBackend' ] and MIDDLEWARE = [ ... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.RemoteUserMiddleware', ... ] Here is the request from the dekstop app if that matters: //This specifically is made with JQUERY //I tried using AXIOS but … -
Double quotes problems with Postgres
I am using Django with postgres. Here's the snippet of my code which I am using to create tables in the db. class user(models.Model): user_id = models.IntegerField(primary_key=True) username = models.CharField(max_length=30) password = models.CharField(max_length=30) role_id = models.ForeignKey(role,on_delete=models.CASCADE) class Meta: db_table = 'user' My question is: why is the user table getting renamed as "user" (with quotes) why is the role_id getting named as role_id_id where as I have clearly mentioned role_id to be my column name? -
NoReverseMatch at - django polls app tutorial
I keep getting this when trying to load da page: NoReverseMatch at /polls/ Reverse for 'vote' with arguments '('',)' not found. 1 pattern(s) tried: ['polls/(?P<question_id>[0-9]+)/vote/$'] In template C:\Users\sarah\Desktop\django2\myproject\my_site\polls\templates\polls\index.html, error at line 20 line 20: <form action="{% url 'polls:vote' question.id %}" method="post"> I am a complete beginner at django, css, html, ... I kept checking in with the tutorial, comparing my code with the code reference in the tutorial, however I see no mistake. My index.html: {% load static %} <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}"> {% if latest_question_list %} <ul> {% for question in latest_question_list %} <li><a href="{%url 'polls:detail' question.id %}/">{{ question.question_text }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> {% endif %} <h1>{{ question.question_text }}</h1> {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} <form action="{% url 'polls:vote' question.id %}" method="post"> {% csrf_token %} {% for choice in question.choice_set.all %} <input type="radio" name="choice" id="choice{{ forloop.counter }}" value="{{ choice.id }}"> <label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br> {% endfor %} <input type="submit" value="Vote"> </form> The vote function in views.py: def vote(request, question_id): question = get_object_or_404(Question, pk=question_id) try: selected_choice = question.choice_set.get(pk=request.POST['choice']) except (KeyError, Choice.DoesNotExist): # Redisplay the question voting form. return render(request, 'polls/detail.html', { 'question': question, 'error_message': "You … -
I want to want a carosel of quotes but I want that the quote text should be feched from a queryset of class Quote. How can I do it?
# models.py class Quote(models.Model): quote = models.TextField() name = models.CharField(max_length=50) active = models.BooleanField(default=True) created_on = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name # views.py def home(request): quotes = Quote.objects.filter(active=True).order_by('-created_on') return render(request, 'website/index.html', {'quotes':quotes}) # index.html <section class="pb-5"> <div class="container"> <div class="row"> <div class="col-lg-10 col-xl-8 mx-auto"> <div class="p-5 bg-white shadow rounded"> <!-- Bootstrap carousel--> <div class="carousel slide" id="carouselExampleIndicators" data-ride="carousel"> <!-- Bootstrap carousel indicators [nav] --> <ol class="carousel-indicators mb-0"> <li class="active" data-target="#carouselExampleIndicators" data-slide-to="0"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <!-- Bootstrap inner [slides]--> <div class="carousel-inner px-5 pb-4"> <!-- Carousel slide--> <!-- Carosel slide --> <div class="carousel-item active"> <div class="media"><img class="rounded-circle img-thumbnail" src="/avatar-3_hdxocq.jpg" alt="" width="75"> <div class="media-body ml-3"> {% for quote in quotes %} <blockquote class="blockquote border-0 p-0"> <p class="font-italic lead"> <i class="fa fa-quote-left mr-3 text-success"></i>{{ quote.quote }}</p> <footer class="blockquote-footer">{{ quote.name }} </footer> </blockquote> {% endfor %} </div> </div> </div> <!-- Bootstrap controls [dots]--> <a class="carousel-control-prev width-auto" href="#carouselExampleIndicators" role="button" data-slide="prev"> <i class="fa fa-angle-left text-dark text-lg"></i> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next width-auto" href="#carouselExampleIndicators" role="button" data-slide="next"> <i class="fa fa-angle-right text-dark text-lg"></i> <span class="sr-only">Next</span> </a> </div> </div> </div> </div> </div> </section> I want a carosel of quotes but I want to use the model as shown above. When I run above code then I want one after …