Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to fix Blocked a frame with origin "https://s3.amazonaws.com" from accessing a cross-origin frame
I have integrated the SCORM xblock with edx-plaform but I am trying to launch my SCORM course it is giving me an error in chrome console. scormfunctions.js:38 Uncaught DOMException: Blocked a frame with origin "https://s3.amazonaws.com" from accessing a cross-origin frame. at ScanForAPI (https://s3.amazonaws.com/dev-ironwood-edx-uploads/scorm/aea0be6310754d3aab1649c5282bbd29/c8d75aa6c54a807e870b6afd4dd9a817aacaccc3/shared/scormfunctions.js:38:16) The exception I am sharing above is raising when a javascript function is trying to access the window.variable of the parent window, and browser is blocking that access to prevent clickjacking attacks. I have tried to search on StackOverflow and other forums but I am unable to find a solution. I have the idea, I will have to play with Content-Security-Policy I will be grateful if anyone can help me in pointing out the header values. -
Python Django PCF SSO
I am trying to enable the SSO service on PCF for my Django application. All the information I found online seems don't give a direct pointer, they are either: you need to set both Provider (Resource URL) and application together, or or, correct examples using Java Spring which hides the details I want to know Anyone successfully done it, may you share the procedures or the library you used? Thanks for your help. -
How can I save data from form in base?
I am study python and Django now. I don't understand, why my form doesn't save and haven't any errors. Here is my code: Model: class TelegramSettings(models.Model): user = models.OneToOneField( User, on_delete=models.CASCADE, related_name='TelegramSettings', default=0 ) bot_name = models.CharField(max_length=255) bot_address = models.CharField(max_length=255) bot_token = models.CharField(max_length=255) def __str__(self): return f'{self.bot_name}: {self.bot_token}' Form: class TelegramSettingsForm(forms.ModelForm): class Meta: model = TelegramSettings fields = ['bot_name', 'bot_address', 'bot_token'] labels = { 'bot_name': 'Имя бота', 'bot_address': 'Адрес бота', 'bot_token': 'Токен' } widgets = { 'bot_token': forms.TextInput( attrs={'size': 30, 'placeholder': '522081070:AAFuXy8ngp32_Cv-sa7a0exdDsfvtraCjVA'}), 'bot_address': forms.TextInput( attrs={'size': 30, 'placeholder': '@somename_bot'}), 'bot_name': forms.TextInput( attrs={'size': 30, 'placeholder': 'Для моего канала'}), } View: @login_required(login_url="/login/") def telegram_settings_view(request): template_name = 'settings.html' saved_data = TelegramSettings.objects.get(user=request.user.id) if request.method == 'POST': form = TelegramSettingsForm(request.POST, instance=request.user) if form.is_valid: form.save(commit=False) webhook = bot_setwebhook(form.cleaned_data['bot_token']) if webhook: bot_deletewebhook(saved_data.bot_token) form.save(commit=True) context = {'form': form, 'is_updated': 'ok'} return render(request, template_name, context) context = {'form': form, 'is_updated': 'error'} return render(request, template_name, context) return render(request, template_name, {'form': form, 'is_valid': form.is_valid()}) if request.method == 'GET': # form = TelegramSettingsForm(initial=model_to_dict(saved_data)) form = TelegramSettingsForm(instance=saved_data) context = { 'form': form, } return render(request, template_name, context) When I generate POST request from my template, everything is ok, but data not saved in base! I am looking for my request in connection(from django.db import … -
How to generate these filenames?
Today most of the website use following types of file names for their static assets. For example, <link rel="stylesheet" href="./assets/app.98443-as3e-adwe3-ddfef-3ddd-de3dsds.css"> The long string between the filename (Here 'app') and the file extension (Here '.css') changes every time when a page is reloaded. I want to know how to achieve this in Django. -
Django | Apply FilterSet within Multiple Models
I'm running a query in Django for a model. However, I would like to know if there is some way possible to extend the query to other models. I'll show my files to exemplify and point out what is exactly that I'm trying to do. models.py from django.db import models class SomeThings(models.Model): id_thing = models.PositiveIntegerField(blank=False, primary_key=True) thing_1= models.PositiveIntegerField(blank=False) thing_2= models.PositiveIntegerField(blank=False) class SomeStuff(models.Model): id_thing = models.OneToOneField(SomeThings, on_delete=models.PROTECT) stuff_1 = models.CharField(max_length=255, blank=False) stuff_2 = models.CharField(max_length=255, blank=False) filters.py import django_filters from .models import * class myFilter(django_filters.FilterSet): class Meta: model = SomeThings fields = '__all__' views.py from django.shortcuts import render from django.http import HttpResponse from .filters import myFilter def search(request): products = SomeThings.objects.all() filter= myFilter(request.GET,queryset=products) products= filter.qs context = {'products':products,'filter':filter,} return render(request, 'search.html', context) search.html {% load static %} ... some html stuff ... <form method="get"> {{ filter.form.thing_1 }} {{ filter.form.thing_2 }} <button class="btn btn-primary" type="submit"> Search </button> </form> Basically, my filter looks indise SomeThings model and renders the query in search.html, however, there is some information in SomeStuff that I would like to use as part of my filter. Here is my pseudo code of what I'm trying to do in search.html {% load static %} ... some html stuff ... <form method="get"> … -
POST Ant Design Upload file with axios to django ImageField
How can i send Ant Design Upload file into my Django backend model ImageField. I am using axios to use PUT method as updating users profiel. At the moment i set my image into state and access file object to send it to my backend. This however throws 404 error. Should i somehow change my file data before POSTing it or what could be issue here? File where i post: state = { file: null, }; handleImageChange(file) { this.setState({ file: file }) console.log(file) }; handleFormSubmit = (event) => { const name = event.target.elements.name.value; const email = event.target.elements.email.value; const location = event.target.elements.location.value; const image = this.state.file; const sport = this.state.sport; axios.defaults.headers = { "Content-Type": "application/json", Authorization: this.props.token } const profileID = this.props.token axios.patch(`http://127.0.0.1:8000/api/profile/${profileID}/update`, { name: name, email: email, location: location, sport: sport, image: image, }) .then(res => console.log(res)) .catch(error => console.err(error)); } when i console.log(file), i can correctly see my file that i have uploaded, but i think sending it causes error -
Unable to connect to Django app in Docker container with Nginx
I'm trying to deploy a Django app locally with django/cookiecutter on Docker using nginx and mkcert for local certifiactes. This sets up an nginx container using jwilder/nginx-proxy:alpine. I'm able to connect to the app at 127.0.0.1:8000 but now I'm trying to develop locally with HTTPS using mkcert. My steps for setting up are as follows: Generate certificates with mkcert, in which I set the url as my-dev-env.local and the key and cert as my-dev-env.local.key and my-dev-env.local.crt. Move the key and cert files into the projects ./cert directory Add the nginx-proxy service to my docker-compose file: nginx-proxy: image: jwilder/nginx-proxy:alpine container_name: nginx-proxy ports: - "80:80" - "443:443" volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - ./certs:/etc/nginx/certs restart: always depends_on: - django Add environment variables in my Django app: # HTTPS # ------------------------------------------------------------------------------ VIRTUAL_HOST=my-dev-env.local VIRTUAL_PORT=8000 Add "my-dev-env.local" to ALLOWED_HOSTS in my Django settings. Everything appears to build and run successfully and as I said, I can connect to the app at http://localhost:8000/. When I attempt to reach https://my-dev-env.local/ I get nowhere: This site can’t be reached my-dev-env.local’s server IP address could not be found. DNS_PROBE_FINISHED_NXDOMAIN I'm confused how my browser is supposed to know to connect to the app when I type in https://my-dev-env.local/. Is there something … -
AttributeError: 'DeferredAttribute' object has no attribute '_meta'
I got this error I don't understand the cause of the error. -
django deployed project raised ascii error code
I deployed my Django project that uses Apache and MySQL. all apps features work fine, but in an application's views.py, when I try to access it, it raises this error. UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9735: ordinal not in range(128) it works fine in localhost I searched a lot but none of them works for me. The views.py of the app has many queries (for calculating), annotate and aggregate also Case(When())? this is my error.log [Fri Aug 21 14:30:46.907352 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] File "/var/www/projectname/venv/lib/python3.6/site-packages/django/views/debug.py", line 94, in technical_500_response [Fri Aug 21 14:30:46.907356 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] html = reporter.get_traceback_html() [Fri Aug 21 14:30:46.907362 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] File "/var/www/projectname/venv/lib/python3.6/site-packages/django/views/debug.py", line 332, in get_traceback_html [Fri Aug 21 14:30:46.907379 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] t = DEBUG_ENGINE.from_string(fh.read()) [Fri Aug 21 14:30:46.907387 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode [Fri Aug 21 14:30:46.907391 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] return codecs.ascii_decode(input, self.errors)[0] [Fri Aug 21 14:30:46.907402 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9735: ordinal not in range(128) [Fri Aug 21 … -
Is there any way to capture image from webcam and store it in database using Django
I'm trying to capture image from webcam and store it in database using Django, But I'm getting " 'method' object is not subscriptable" this error. I am using javascript to use webcam to capture image and assign that image to image tag using js. Is there any way to access webcam to capture image and then process it to store into database in Django or is it possible by using django-forms?? Here's my Views.py def register(request): if (request.method == 'POST'): rollNumber = request.POST['rollNumber'] firstname = request.POST['firstname'] lastname = request.POST['lastname'] email =request.POST['email'] phone = request.POST['phone'] year = request.POST['year'] shift = request.POST['shift'] img = request.POST.get['student_img'] student = Student.objects.get() student.rollNumber = rollNumber student.firstname = firstname student.lastname = lastname student.phoneNumber = phone student.email = email student.year = year student.shift = shift student.image = img student.save() print("data recieved") return HttpResponse("Image upload successful\n Welcome " + firstname + " " + lastname) else: print("Error") return HttpResponse("Error") Here's index.html {% load static %} <!doctype html> <html> <body> <div class="content-agileits"> <h1 class="title">Student registration Form</h1> <div class="left"> <form action="register" method="post" enctype="multipart/form-data" data-toggle="validator"> {% csrf_token %} <div class="form-group"> <input type="text" class="form-control" id="firstname" name="firstname" placeholder="First Name" data-error="Enter First Name" required> <div class="help-block with-errors"></div> </div> <div class="form-group"> <input type="text" class="form-control" id="lastname" name="lastname" … -
Django request.POST returns an empty dict
code skips the whole if block directly goes to the last else. I am using django.forms to get input from the user. the same thing happens when the method is set to GET. I tried the same with normal HTML forms the same result. But the weird fact it earlier It was working properly in the initial stages of the project while I was experimenting with my views and models this start causing the error in my project as I cannot get the user input. views.py def output(request): print(request.POST) # returns empty dict if request.method == "POST": form = InputForm(request.POST) if form.is_valid(): url = form.cleaned_data['input_url'] print(url) return render(request, 'classifier/output.html', {'url':url}) else: print(form.errors()) else: print("error") error = "Oops" return render(request, 'classifier/output.html',{'url':error}) -
IntegrityError at /update_order/ duplicate key value violates unique constraint "app_order_pkey".DETAIL: Key (id)=(54) already exists
I am getting the above error . This is my updateorder view: def updateorder(request): data = json.loads(request.body) orderid = data['orderid'] status = data['status'] order, created=Order.objects.update_or_create(id=orderid, status=status) return JsonResponse('Status was updated',safe=False) and this is my js: var updateBtns = document.getElementsByClassName('update-status') for (i=0;i<updateBtns.length;i++){ updateBtns[i].addEventListener('click',function(){ var orderid=this.dataset.orderid var updatestatus = document.getElementById(orderid); var status = updatestatus.options[updatestatus.selectedIndex].value; updateOrderStatus(orderid,status) }) } function updateOrderStatus(orderid,status){ console.log('User is logged In , sending data....') var url = "/update_order/" fetch(url, { method:'POST', headers:{ 'Content-Type':'application/json', 'X-CSRFToken':csrftoken, }, body:JSON.stringify({'orderid':orderid,'status':status}) }) .then((response) =>{ return response.json() }) .then((data) =>{ console.log('data:',data) location.reload() }) } What I am wanting to do is that I have a admin page for my website where i see all orders and I am wanting to from that page change the status of the order. This is my selectbox for reference: <select name="dstatus" id="{{ord.id}}" class="updatestatus"> <option value="Preparing" id="Preparing" >Processing</option> <option value="Out For Delivery" id="Out For Delivery">Out For Delivery</option> <option value="Delivered" id="Delivered">Delivered</option> <option value="Cancelled" id="Cancelled">Cancelled</option> </select> <button data-orderid={{ord.id}} class="btnabc btnabc-outline-cottgin update-status">update</button> and this is my order mode: class Order(models.Model): customer=models.ForeignKey(Customer,on_delete=models.SET_NULL,null=True,blank=True) status = ( ("Preparing", "Preparing"), ("Delivered", "Delivered"), ("Out For Delivery", "Out For Delivery"), ("Cancelled","Cancelled") ) status=models.CharField(max_length=20,blank=True,null=True,choices=status) So my aim is that whenever from my page I change the status of order It changes … -
How do i add small number like 1/4 in the input text of html?
I'm a beginner in django Web Development,i am doing a project for a tailoring shop . my client want me to put measurement with fraction value like 1/2 with condition that the measurement should be bigger than the fraction value, is like 45 1/2 . Measurement value 45 want to be bigger and 1/2 as smaller I tried changing the font size but both will be get changed HELP me to solve this problem enter image description here -
Django Rest Framework Syntax issues [closed]
Hi I've written this code and I'm learning Django + Django Rest Framework DEFAULT_RENDERER_CLASSES = [ 'rest_framework.renderers.JSONRenderer', ], if DEBUG: DEFAULT_RENDERER_CLASSES += [ 'rest_framework.renderers.BrowsableAPIRenderer' ] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.SessionAuthentication' ], 'DEFAULT_RENDERER_CLASSES': DEFAULT_RENDERER_CLASSES, } and when I try to run it it says there is a type error with this error DEFAULT_RENDERER_CLASSES += [ TypeError: can only concatenate tuple (not "list") to tuple I've tried doing a list, and doing = instead however, I cannot find a solution. Any tips? -
Django get_query_set ValueError
I'm trying to create a ListView in django for Post categories. So for each post i'm including a link which sends you to a page containing all posts with the same category. I'm using get_queryset on my PostCategoryListView in order to filter them but it shows me the error Field 'id' expected a number but got 'technology' My models: from django.db import models from django.contrib.auth.models import User from django.utils import timezone class Category(models.Model): type = models.CharField(max_length = 20) image = models.ImageField(default = 'default.jpg', upload_to = 'category_pics') def __str__(self): return self.type class Post(models.Model): title = models.CharField(max_length = 30) content = models.TextField() date_posted = models.DateTimeField(default = timezone.now) author = models.ForeignKey(User, on_delete = models.CASCADE) category = models.ForeignKey(Category, on_delete = models.CASCADE) def __str__(self): return self.title def get_absolute_url(self): return reverse('post-detail', kwargs={'pk': self.pk}) My views.py : class PostCategoryListView(ListView): model = Post template_name = 'blog/category_posts.html' context_object_name = 'posts' def get_queryset(self): kategoria = get_object_or_404(Post , category = self.kwargs.get('category')) return Post.objects.filter(category = kategoria) My anchor tag in htmt: <a href="{% url 'post-category' post.category %}"><h2>{{ post.category }}</h2></a> My urls.py: urlpatterns = [ path('admin/', admin.site.urls), path('', PostListView.as_view() , name='blog-home'), path('post/<str:username>/', UserPostListView.as_view(), name = 'user-posts'), path('post/<int:pk>/', PostDetailView.as_view(), name = 'post-detail'), path('post/new/', PostCreateView.as_view(), name = 'post-new'), path('post/<int:pk>/delete/', PostDeleteView.as_view(), name = 'user-posts'), path('category/<str:category>/', PostCategoryListView.as_view(), … -
how can i do payment setup in django using strip
hi i will create a blog website... when user upload post than they select subscription plan and post will created depends on subscription plan(like one month plan etc..) suggest me how can i do this using strip -
How do I add phone number field to django UserCreationForm?
I want to add PhoneNumberField so I can use take phone number of user at time registration. I already have UserCreationForm model which is used by CreateUserForm to create a new User. However by default it does not phone number field. I tried adding it by adding phone variable in forms.py but it does not work giving the error below. forms.py class CreateUserForm(UserCreationForm): phone=PhoneNumberField() class Meta: model = User fields = ['username', 'email', 'password1', 'password2', 'phone'] models.py class CustomerReg(models.Model): user=models.OneToOneField(User, null=True, blank=True, on_delete=models.CASCADE) name=models.CharField(max_length=200, null=True) email=models.EmailField(max_length=254) phone=PhoneNumberField(default=None) def create_profile(sender, **kwargs): if kwargs['created']: user_profile=CustomerReg.objects.create(user=kwargs['instance']) post_save.connect(create_profile, sender=User) This is Error I get when I run python manage.py makemigrations Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "D:\djangoL2G\venvP\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "D:\djangoL2G\venvP\lib\site-packages\django\core\management\__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "D:\djangoL2G\venvP\lib\site-packages\django\core\management\base.py", line 330, in run_from_argv self.execute(*args, **cmd_options) File "D:\djangoL2G\venvP\lib\site-packages\django\core\management\base.py", line 368, in execute self.check() File "D:\djangoL2G\venvP\lib\site-packages\django\core\management\base.py", line 396, in check databases=databases, File "D:\djangoL2G\venvP\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks new_errors = check(app_configs=app_configs, databases=databases) File "D:\djangoL2G\venvP\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "D:\djangoL2G\venvP\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "D:\djangoL2G\venvP\lib\site-packages\django\urls\resolvers.py", line 408, in check for pattern in self.url_patterns: File "D:\djangoL2G\venvP\lib\site-packages\django\utils\functional.py", line … -
Receiving values of a column of django table once
I have these entries in my database: name salary height Ema 2.3 1.70 Sarah 3 1.68 Emily 2.3 1.82 Jane 3 1.73 My model is: #models.py class information(models.Model): name= models.CharField(max_length=100, default='No_name') salary= models.DecimalField(max_digits=4, decimal_places=2, null=True) height= models.DecimalField(max_digits=4, decimal_places=2, null=True) How can I retrieve all possible salaries? I want to receive s= [2.3, 3] as the result. If I try I= information.objects.all() and then s= I.salary, I will receive s=[2.3, 3, 2.3, 3] as the result, but I want to have each value once in s. -
Benefits of using django-channels instead of not using it
I am working on a chat application, and I am wondering what are the benefits of for example using django-channels instead of making the chat in "raw" django? Thank you in advance. -
How to get week number of a month in django orm?
I am trying to get the week of the month, for example "March (week 1 (days 1 to 7), week 2 (days 8 to 15), week 3 (days 16 to 23), week 4 (days 24 to 31)) "I have tried this: data['month'] = list(Records.objects.annotate(month=Month('date'), week=YearWeek('date')).filter(month=8).values("date", "week").annotate(month_sum=Sum('tot')).order_by()) class Month(Func): function = 'EXTRACT' template = '%(function)s(MONTH from %(expressions)s)' output_field = IntegerField() class YearWeek(Func): function = 'EXTRACT' template = '%(function)s(WEEK from %(expressions)s)' output_field = IntegerField() -
from python crash course web app django project
[enter image description here][1] I am trying to do the web app project and attempting to print topic ids but it prints only Object(number) and I am pretty sure it has to do something with django admin [1]: https://i.stack.imgur.com/1WkEr.png -
Django REST framework Access data from a ForeignKey of a OneToOneField
I'm trying to access data from serializer of DRF. I have some model like this class Visit(models.Model): LogInTime = models.DateTimeField(null=True) LogOutTime = models.DateTimeField(null=True) IsLogOut = models.NullBooleanField(null=True) Description = models.CharField(max_length=300, def __str__(self): return self.Description class Person(models.Model): Visit = models.OneToOneField( visit, on_delete=models.CASCADE) def __str__(self): return self.visit.Description class EmployeeTypePerson(models.Model): Person = models.ForeignKey( Person, on_delete=models.CASCADE) Employee = models.ForeignKey( 'Employee', on_delete=models.CASCADE) class VisitorTypePerson(models.Model): Person = models.ForeignKey( Person, on_delete=models.CASCADE) Visitor = models.ForeignKey( 'Visitor', on_delete=models.CASCADE) VisitingTo = models.ForeignKey( 'Employee', on_delete=None, null=True) Now i want to update all data By serializer As like ----- Visit > Person > EmployeeTypePerson / VisitorTypePerson NOTE : EmployeeTypePerson & VisitorTypePerson both have ForeignKey And i need to update those -
How to make one to many relationship that uses many diffrent models in Django?
I'm writing one of first Django apps and I have recipe model like this: class Recipe(models.Model): name = models.CharField(max_length=64) and also many other models for steps in recipe: class BaseStep(models.Model): recipe = models.ForeignKey('recipe.Recipe', on_delete=models.CASCADE) class TextStep(BaseStep): text = models.CharField(max_lengh=4096) class ListStep(BaseStep): list_elements = models.CharField(max_length=2048) class TimerStep(BaseStep): time = models.PositiveIntegerField() above models are simplified, what makes them pointless but I need them this way. I know that normally I would specify ForeignKey in BaseStep so that I have some reference, like this: recipe = models.ForeignKey('recipe.Recipe', related_name='steps', on_delete=models.CASCADE) but this simply doesn't work, because it's inherited by child models, with is not OK because related_name needs to be unique. In the end I need to have field steps in Recipe that will return array or queryset of all the steps. I know that Proxy Models can do something like that but using it here is stupid. Now that I'm thinking, is making a @property function in Recipe, that will query all steps and return python array out of them class a good idea? I need to serialize it in the end, for rest endpoint. -
Django Annotate Getting full list of Users and add flag. Removing users that appear as duplicate
Been stuck on this for a good few hours now, I'm sure its something simple im missing. I want to get full list of Users, but with 'participant' flag added if they are in Project.participants(m2m). That part works! Model: class Project(TimeStampedModel, Slugify): ... participants = models.ManyToManyField(User, blank=True, related_name='%(app_label)s_%(class)s_participants') ... User.objects. .queryset.annotate( participant=Case( When( projects_project_participants__in=project_id, then=Value(project_id)) , output_field=IntegerField() ) ) .order_by('id') I can get the right results if I filter out the rest. But I want to keep full queryset with both true and false. The issue is, if a User is part of 5 groups for instance, then I have both True and False records in data set. (i have 2 results as i have set distinct, but left with a true and false version from different projects). Any ideas of best approach or a simple filter I am missing. -
{{ form.media }} adds jquery.min.js between different servers
I have 2 servers and 2 different interpretations of {{ form.media }} <link href="/static/admin/css/vendor/select2/select2.min.css" type="text/css" media="screen" rel="stylesheet"> <link href="/static/admin/css/autocomplete.css" type="text/css" media="screen" rel="stylesheet"> <link href="/static/autocomplete_light/select2.css" type="text/css" media="screen" rel="stylesheet"> <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.min.js"></script> <script type="text/javascript" src="/static/autocomplete_light/jquery.init.js"></script> <script type="text/javascript" src="/static/admin/js/vendor/select2/select2.full.min.js"></script> <script type="text/javascript" src="/static/admin/js/vendor/select2/i18n/en.js"></script> <script type="text/javascript" src="/static/autocomplete_light/autocomplete.init.js"></script> <script type="text/javascript" src="/static/autocomplete_light/forward.js"></script> <script type="text/javascript" src="/static/autocomplete_light/select2.js"></script> <script type="text/javascript" src="/static/autocomplete_light/jquery.post-setup.js"></script> The difference is just one line: <script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.min.js"></script> If this one is activated, the select / change of the select2 dropdown doesn't work anymore. If this is commented, it works again. I checked the pip freeze and they have the same packages versions: Django==2.2 django-autocomplete-light==3.3.4 How is that possible that this line get added?