Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django - Upload multiple files using filepaths provided in an excel file
Hope everyone is doing well. I'm trying to figure out how I can upload files from a file path provided in an excel file. Basically I'm allowing the user to upload multiple documents at once but the document name has to be different as such I'm using an excel upload file. How would I go about: Checking if the file exists (I.E File path is accurate) Getting the file to save to model Currently for 1 I'm using: error_list = [] i = 1 for record in df_records: my_file = Path(record['file_path']) try: my_abs_path = my_file.resolve(strict=True) except FileNotFoundError: error_list.append(f"Error in row: {i}, file path incorrect or file does not exists") I'm still looking for a solution, if I find it before someone answers I will post the answer. :) Thanks in advance, Tom -
Wrong table names format - Django
I'm having an issue with the table names format of my Django project. Here is a sample of a model I have: class WalletHistory(models.Model): wallet = models.ForeignKey(Wallet, on_delete=models.CASCADE, related_name='wallet_history') free_amount = AmountField(default=None, blank=True, null=True) locked_amount = AmountField(default=None, blank=True, null=True) flexible_amount = AmountField(default=None, blank=True, null=True) date_created = models.DateTimeField(auto_now_add=True, blank=True) The app associated with this model is called core so the table name is supposed to be core_wallet_history. But Django names my table core_wallethistory instead: it doesn't split the class names with underscore. I've changed nothing in the Django settings. -
Django messages not displaying properly but only on one page
I have a generic CreateView where users can submit a problem about an item. When a problem has not been submitted about an item, a submission template is show, when a user has submitted a problem, a template with the message history for that problem is shown. class PhotoProblemView(LoginRequiredMixin, CreateView): form_class = PhotoProblemMessageForm def get_template_names(self): if PhotoProblem.objects.filter(photo=self.kwargs.get('pk')).count() <= 0: return ['photo/photo_problem_create.html'] else: return ['photo/photo_problem_message.html'] def get_success_url(self): if PhotoProblemMessage.objects.filter(problem__photo_id=self.kwargs.get('pk')).count() <= 1: messages.success(self.request, "Your issue has been reported. Please allow 1 business day for a follow up.") return reverse('photo_problem', kwargs={'pk': self.kwargs['pk']}) else: return reverse('photo_problem', kwargs={'pk': self.kwargs['pk']}) def get(self, *args, **kwargs): if not Photo.objects.filter(id=self.kwargs['pk'],user=self.request.user).exists(): raise Http404 return super().get(*args, **kwargs) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['photo'] = Photo.objects.get(id=self.kwargs['pk']) try: context['photo_problem'] = PhotoProblem.objects.get(photo_id=self.kwargs['pk']) except PhotoProblem.DoesNotExist: pass context['messages'] = PhotoProblemMessage.objects.filter(problem__photo_id=self.kwargs.get('pk')).order_by('created') return context def form_valid(self, form): try: problem = PhotoProblem.objects.get(photo_id=self.kwargs.get('pk')) except: problem = PhotoProblem.objects.create(photo_id=self.kwargs.get('pk')) problem.save() if problem.resolved == True: messages.error(self.request, "This issue has been resolved, you can no longer send messages. Please contact us if you need more help.") return super(PhotoProblemView, self).form_invalid(form) self.object = form.save(commit=False) self.object.problem = problem self.object.user = self.request.user self.object.save() return super(PhotoProblemView, self).form_valid(form) The issue is that when Django renders the message history template, it also is rendering messages stacked on top of each … -
Setup React, Python and Neo4j in Docker
I'm trying to set up a Docker container running React on the frontend, Django on the backend and Neo4j as the database. At the moment all three components are running correctly, but I just can't get Django to connect to the Neo4j database. I've probably read all the tutorials on the internet and tried all the things but it always comes up with some error and the database is unreachable or denies access. I have also worked through this tutorial and created the models accordingly. However, I always get an error when I run "python manage.py install_labels". As it looks I either can't connect to the database or the request is rejected. Has anyone of you ever set up a similar environment or can help me? Maybe Django is just not that suitable for it .... Basically I just want a React frontend and a Python backend working with a Neo4j database. And the whole thing please in a Docker image. Are there any better alternatives for the backend? Thanks in advance for your help! In the following you can see all of my files that are important in my opinion. My Dockerfiles look like this: # Django Dockerfile FROM … -
How do I deploy a monolithic Django/React app?
I’m trying to find a way to deploy my app that uses Django on the backend and React front end, and also uses the Spotify API. The project is based on this tutorial by Tech With Tim I’ve seen some tutorials that suggest splitting it up and deploying them as two apps, where the backend proxies API requests to the backend as necessary, however since my React app is served with Django, I don’t think this method is conducive to how my app is set up. I've tried to deploy with Heroku but I haven't been successful. I'm not sure if its relevant, but I used webpack. Here's my folder structure: Any help? I’d be much obliged. -
Adding instance name of FK to upload_to folder
I'm trying to save files in a specific folder depending on a foreign key of the model. This is the model where files are uploaded: class PersonVisual(models.Model): person = models.ForeignKey(Person, on_delete=models.CASCADE, related_name='visual') file = models.FileField(upload_to=upload_to_people_instance_folder) class Meta: verbose_name_plural = "people visuals" This is the function for upload_to, like I saw in other SO questions: def upload_to_people_instance_folder(instance, filename): clean_name = f"{instance.person.first_name}_{instance.person.last_name}" return f"/people/visual/{clean_name}/{filename}" That did what was expected, but I get the following error: SuspiciousFileOperation at /admin/others/person/1/change/ Detected path traversal attempt in '/people/visual/firstname_lastname/filename.jpg' So thats clearly not the way to go, maybe Im missing something? -
Which Python Library is suited to develop an AI chat bot?
I am currently developing a social media website with a lot of privacy settings and processes, which may require the users utilizing the application to need guidance through them smoothly and clearly, and I have been wondering to make an AI chat bot to serve as an assistant to the users, This website is made by Python Django MVC framework, What I am looking for is a python library that is executed like NumPy with C++, Fast performance Python AI library. I would like to know which library is most suitable to perform this task?. Thanks in advance. -
how to connect Django-Rest-Framework to Azure Cosmos DB(MongoDb)
I used these configuration but it is not connecting to azure DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'cloud_db', ---db name 'ENFORCE_SCHEMA': False, 'CLIENT': { 'host': 'db.documents.azure.com', 'port': 443, 'username': 'db', 'password':master_key, 'authSource': 'cloud_db', 'authMechanism': 'SCRAM-SHA-1' }, 'LOGGING': { 'version': 1, 'loggers': { 'djongo': { 'level': 'DEBUG', 'propagate': False, } }, }, } } I'm getting this error [2022-02-16T22:28:54.401Z] Result: Failure [2022-02-16T22:28:54.401Z] Exception: ImproperlyConfigured: 'djongo' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of: [2022-02-16T22:28:54.401Z] 'mysql', 'oracle', 'postgresql', 'sqlite3' Can Anyone Please help me to solve this issue, please help me with the configuration? I have: host:https://db.documents.azure.com:443/ master_key:ACCOUNT_KEY database_id:database id DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': '', 'ENFORCE_SCHEMA': False, 'CLIENT': { 'host': '', 'port':'', 'username': '', 'password':'', 'authSource': '', 'authMechanism': 'SCRAM-SHA-1' }, 'LOGGING': { 'version': 1, 'loggers': { 'djongo': { 'level': 'DEBUG', 'propagate': False, } }, }, } } -
Save data from ChoiceField to database Django
I'm new to Django and I have built a Form that shows a single select field to chose from. The data in the field are calculated on the go by the Form. I now need, once the data is being submitted, to be save on the database. The only problem is that, for some reason, I got an IntegrityError error NOT NULL constraint failed: manager_playlist.user_id Below my view, form and model in Django views.py def playlist(request): if not is_user_already_auth_spotify(request): messages.error(request, "You're not authenticated with Spotify, please authenticate here") return redirect('/members/account/' + request.user.username) if request.method == "POST": form = ChoosePlaylistForm(request.POST, request=request) if form.is_valid(): form.save() messages.success(request, "Playlist successfully chosen") return HttpResponseRedirect('account') else: pass else: form = ChoosePlaylistForm(request=request) return render(request, 'show_playlist.html', {"playlist_choose_form": form}) forms.py class ChoosePlaylistForm(ModelForm): playlists = forms.ChoiceField(choices=()) class Meta: model = Playlist fields = ('playlists',) def __init__(self, *args, request=None, **kwargs): super(ChoosePlaylistForm, self).__init__(*args, **kwargs) self.request = request self.fields['playlists'].choices = self.generate_selection() def generate_selection(self): sp_auth, cache_handler = spotify_oauth2(self.request) spotify = spotipy.Spotify(oauth_manager=sp_auth) s_user = spotify.current_user() u_playlists = spotify.user_playlists(s_user['id'], limit=10) choices = [] for playlist in u_playlists["items"]: if playlist["owner"]["id"] == s_user['id']: playlist_choice = (playlist["id"], playlist["name"]) choices.append(playlist_choice) else: pass return choices model.py## class Playlist(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) playlists = models.CharField(max_length=50, null=True, blank=True) # playlists are the … -
Checking if something exists and adding or getting an object from django
I'm scrapping a shop from Woocommerce, and i'd like to take the products brand name, and compare if there's already name like this in the database and if so put the id of it in our base and if not, create an instance of a productProducer for page in range (99, 100): parameters = {'per_page': 1, 'page': f'{page}', 'stock_status': 'instock', 'status': 'publish'} products = wcapi.get("products", params=parameters).json() for product in products: print(product) name = product['name'] slug = product['slug'] description = product['description'] id = product['id'] price = product['price'] link = product['permalink'] for brands in product['images']: brands_name = brands['name'] for image in product['images']: src = image['src'] print(product['categories']) parsed_categories = [] for category in product['categories']: parsed_categories.append(dir[str(category['id'])]) print(parsed_categories) db_product = Product.objects.create(name=name, slug=slug, product_producer_id=1, unique_id=int(id), description=description) db_product.product_category.set(parsed_categories) ProductInStore.objects.create(product=db_product, store_id=1, price=price, currency='PLN', url=link) ProductImage.objects.create(product=db_product, url=src) I have a dir with mapping keys and values for parsing categories outside. Models look like this: class ProductImage(models.Model): product = models.ForeignKey('Product', on_delete=models.CASCADE) filename = models.FileField(upload_to='ecommerce_product_img/', null=True, blank=True) url = models.CharField(max_length=200, null=True,blank=True) class ProductProducer(models.Model): name = models.CharField(max_length=200, unique=True) slug = models.SlugField(max_length=200, unique=True, null=False, editable=False) created_at = models.DateTimeField(editable=False, default=timezone.now) updated_at = models.DateTimeField(default=timezone.now) Id like to check if brands_name already exists in productProducer_name and if not, create a new instance of ProductProducer, then also … -
Django updating value in a loop
Please keep in mind, that I just started learning Django and MySQL. I created a script that can read my transactions from my bank statements and added them to a MySQL table which contains the following fields: id,amount,creditordebit,bookingdate ,partner ,category I'm trying to create an interactive site to loop over the newly added data and update the category field based on the transaction type/partner. I want to loop over them one by one and categorize them using forms.ChoiceField. So far I have created the forms.py and the forms.ChoiceField and choices list, but I am having trouble creating a view and template for this. I have tried to use the QuerySet iterate() but I could not get the next item by id, it jumped straight to the last id. Is this even possible with Django only or do I need to also include some JavaScript? Thanks! -
Django Cors Allow Access-Control-Allow-Headers
I'm trying to make a simple API using Django. I have setup a django server, and then on my own html file I send requests using $.getJSON. So far it's been working using the django cors headers package. Now I've been trying to send a request header to my django server, but I'm getting this error in the Chrome console: Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/?q=example+query' from origin 'http://localhost:63342' has been blocked by CORS policy: Request header field Example-Header is not allowed by Access-Control-Allow-Headers in preflight response. I'm not sure what's the problem, I have django-cors setup correctly and I am able to make requests, I'm just not allowed to set request headers. Setup: INSTALLED_APPS = [ ... 'corsheaders', ] MIDDLEWARE = [ ... 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ... ] CORS_ALLOWED_ORIGINS = [ "http://localhost:63342" ] <script> $.ajaxSetup({ beforeSend: function(request) { request.setRequestHeader("Example-Header", 'Example-Value'); }, }); $.getJSON("http://127.0.0.1:8000/api/?q=example+query", function (data) { console.log(data); }); </script> @cache_page(60 * 60 * 24 * 7) def ExampleAPI(request): if request.method == 'GET': print(request.headers['Example-Header']) # Print Header Value print(request.GET.get('q')) # Print URL Query Parameter Value return JsonResponse([{"Example-Response": "Example-Response-Value"}], safe=False) So what am I doing wrong? Does django-cors not support this? I tried reading the docs but I could not find anything. Thanks. -
MQL4 WebRequest POST Json to Django API using Django rest framework, getting \x00 at the end of body
I am using Django only for few weeks so there might be some mistakes. I have an API using Django rest framework, which seems to work well. Using postman every thing is ok I send data using WebRequest in Mql4 to the api char data[]; data = {...} int r = WebRequest("POST", "http://127.0.0.1/api/symbol/","Content-Type: application/json",5000, data,res_data, res_headers); The data given to WebRequest is fine but the function add \x00 at the end of body. Here is my post data when it arrive to Django rest framework {'Content-Length': '982', 'Content-Type': 'application/json', 'Accept': 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*', 'Host': '127.0.0.1', 'Accept-Language': 'fr,en', 'Accept-Charset': '*,utf-8', 'Connection': 'Keep-Alive', 'Proxy-Connection': 'Keep-Alive', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'User-Agent': 'MetaTrader 4 Terminal/4.1353 (Windows NT 6.1; x86)'} b'{"name": "GOLDs","date_market": "2022-02-01T00:00:00.000000Z","period": "M1","open_price": 1797.64,"close_price": 1870.91,"low_price": 1788.33,"high_price": 1879.12,"bollinger_band":[{"period":"M1","moving_average_period":20,"standard_deviation":1.5,"high":1936.06829,"low":1717.61271,"moving_average":1826.8405},{"period":"M1","moving_average_period":20,"standard_deviation":2,"high":1972.47755,"low":1681.20345,"moving_average":1826.8405},{"period":"M1","moving_average_period":20,"standard_deviation":2.5,"high":2008.88681,"low":1644.79419,"moving_average":1826.8405}],"moving_average":[{"period":"M1","moving_average_period":50,"type": "0","value":1569.6854},{"period":"M1","moving_average_period":100,"type": "0","value":1399.8002},{"period":"M1","moving_average_period":200,"type": "0","value":1245.38985}],"MACD_zerolag":[{"period":"M1","fast_EMA_period":12,"slow_EMA_period":26,"signal_EMA_period":9,"histogram_value":-0.01794,"signal_value":0.09465,"MACD_value":0.07671}]}\x00' so I get the following error : POST /api/symbol/ - 400 {'Content-Type': 'application/json', 'Vary': 'Accept', 'Allow': 'GET, POST, HEAD, OPTIONS'} b'{"detail":"JSON parse error - Extra data: line 1 column 982 (char 981)"}' if a send the same data removing the \x00 with Postman every thing goes well. Is there a misconfiguration client side with mql4 ? Or can I remove the received data to remove this \x00 ? Here is my models.py … -
Django dropdown select by text
I have a simple django dropdown form. I want to grab the text instead of the value. <select name="doctors" required="" id="id_doctors"> <option value="" selected="">---------</option> <option value="3">some text</option> </select> On selection I want to use the some text in the backend. if 'bookAppointment' in request.POST: print(request.POST['doctors']) this prints out the value 3 is there a way to just get some text out. -
How to change the default error message of username in Django
I wanna change the default error message of username of User in models.py. My simple custom user model is like this. class User(AbstractUser): nickname = models.CharField(max_length=10, unique=True, null=True) image = models.ImageField(upload_to='users/', null=True) I did put the below code in models.py, but it seems it doesn't work. Why is this wrong? User._meta.get_field('username').error_messsages = { 'unique': _('New message'), } -
Django Querset Aggregate on boolean Or
In the Django queryset docs, the following aggregate operation is performed: Book.objects.all().aggregate(Avg('price')) I'm wondering if there's a way to do something similar, but with the or operation. Instead of taking the average on a field with numbers it would take the or of all boolean values for a given attribute -
Initialize search query into a form and submit in Django
I want that anytime someone do a search, I want to initialize the search word into the form and submit into the database. It will be initialed to the voucher field which is a foreign to the voucher model in the registration model class TrackingWarehouse(generic.ListView): model = Voucher context_object_name = 'warehouse_list' template_name = 'warehouse-tracking.html' def get_queryset(self, **kwargs): # new query = self.request.GET.get('q', default='') object_list = Voucher.objects.filter( Q(name__iexact=query) ) return object_list def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form'] = Registerform(initial={ 'voucher': self.request.GET.get('q', default='') }) return context class RegistrationFormView(generic.CreateView): template_name = 'formnew.html' form_class = Registerform model class Voucher(models.Model): name = models.CharField(max_length=120, null=True, blank=True) class RegistrationForm(models.Model): voucher = models.OneToOneField(Voucher, on_delete=models.CASCADE) year = models.ForeignKey(Year, null=True, blank=True, on_delete=models.CASCADE) choose_certification = models.CharField(max_length=120, choices=OFFERED_COURSES) full_Name = models.CharField(max_length=200,) Date_of_birth = models.CharField(max_length=100) nationality = models.CharField(max_length=120) email = models.EmailField() -
How to pass a Queryset to a formset Field Django
I have a field 'product' in a formset , i want to make a queryset on that field OrderFormSet = inlineformset_factory(Order, OrderItems,fields=('product','item_price','quantity'), extra=0, ) -
Django Templating Language objects comparison
I'm fairly new to Django. I have a database with Events. I want to display the name of the Organisation where org_id is the foreign key in the events model. My approach was to load in all the objects and then do some iterating through them but I get no output on the website. I feel like its got to do something with the templating language models.py class Organisation(models.Model): org_id=AutoSlugField(unique=True) name = models.CharField(max_length=200) email=models.EmailField(max_length = 250) class Event(models.Model): event_id = AutoSlugField(unique=True) name = models.CharField(max_length=100) date = models.DateField() event_category = models.CharField(max_length=50) duration= models.IntegerField() org_id = models.ForeignKey(Organisation,on_delete=models.CASCADE) maxparticipants= models.IntegerField() teacher_id=models.ForeignKey(User,on_delete=models.CASCADE) releveant snippet from event_details.html <h3>Hosting Body</h3> {% for org in orgs%} {%if org.org_id == event.org_id %} <p>{{org.name}}</p> {%endif%} {%endfor%} <h3>Date</h3> <p>{{event.date}}</p> views.py def event_details(request,pk): event=Event.objects.get(event_id=pk) orgs=Organisation.objects.all() context={'event':event,'orgs':orgs} return render(request,'event_details.html',context) -
How Do You Trigger HTMX Page Refresh After User Updates Any Part of The Page?
I have been working with HTMX and it's pretty cool compared to the dreaded formsets and Javascript. I have it working....My only issue is when the user updates the form anywhere...you have to manually refresh the page to reset the list of todos. My issue is identical to this one...https://stackoverflow.com/questions/66664407/dynamically-update-table-when-creating-new-enty-using-htmx but there is not resolution listed..... Here's a quick overview of my code... My view... def create_to_do(request): user = User.objects.get(id=request.user.id) to_dos = NewToDo.objects.filter(created_by=user) form = ToDoForm(request.POST or None) if request.method == "POST": if form.is_valid(): to_do = form.save(commit=False) to_do.created_by = user to_do.creation_date = timezone.now() to_do.save() return redirect("MyToDoList:detail-to-do", pk=to_do.id) else: return render(request, "partials/to_do_form.html", { "form":form }) context = { "form": form, "user": user, "to_dos": to_dos, } return render(request, "create_to_do.html", context) Partial detailview.... <button class="button35" hx-get="{% url 'MyToDoList:update-to-do' to_do.id %}" hx-swap="outerHTML"> Update </button> <button class="button34" hx-post="{% url 'MyToDoList:delete-to-do' to_do.id %}" hx-swap="outerHTML"> Delete </button> </div> Partial todo form.... <div hx-target="this" hx-swap="outerHTML" class=""> <form method="POST"> {% csrf_token %} {% if to_do %} <button class="button35" hx-post="{% url 'MyToDoList:update-to-do' to_do.id %}"> Save </button> <button class="button34" hx-get="{% url 'MyToDoList:detail-to-do' to_do.id %}"> Cancel </button> </div> {% else %} <button class="button35" hx-post="."> Save </button> </div> {% endif %} </form> </div> My main create form html.. <button class="button36" hx-get="{% url 'MyToDoList:create-to-do-form' … -
Combine rows on django queryset
I have a querset with attributes location, person and error I need to either create a new queryset or edit an existing one such that rows are "combined" based on a certain criteria This criteria is if the location and person are the same Once combined, I want to make the error value be true if any of the rows that are being combined had a true value In this case, Location Person Error L1 P1 false L1 P1 true L2 P2 false L2 P2 false Location Person Error L1 P1 true L2 P2 false -
how to check the null property of a charfield null=true before migration?
I am new to Django and I want to implement a solution to the following problem : I would like to check before any migrations if my new charfield model fields have the attribute null set to false. If not i do want to stop the migrations and trigger a warning to inform the developer about it. How could I achieve that ? -
Save nested objects to ManyToMany field with DRF
Model: class Thread(models.Model): """Thread model for messages.""" participants = models.ManyToManyField(to=User, verbose_name=_("Participants")) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("Created")) updated_at = models.DateTimeField(auto_now=True, verbose_name=_("Updated")) I have this serializers: class UserSerializer(serializers.ModelSerializer): """Serialize User model to get data from ManyToMany field to use in Thread participants.""" class Meta: model = User fields = ("id", "email") class ThreadSerializer(serializers.ModelSerializer): """Serializer for create, get, edit, delete Thread.""" participants = UserSerializer(read_only=True, many=True) class Meta: model = Thread fields = ("id", "participants", "created_at", "updated_at") And views: class ThreadListCreate(generics.ListCreateAPIView): """ Get threads list with participants details. Creates a new thread with two participants. """ permission_classes = (AllowAny,) queryset = Thread.objects.all() serializer_class = ThreadSerializer I need to create new Thread with exactly two users in "participants", how do I can? Also, to assign new users to "participants" I need to type only "id", like code below: { "participants": [ {"id": 1}, {"id": 4} ] } Now as a result of POST code above I get this: { "id": 28, "participants": [], "created_at": "2022-02-16T18:22:17.524911Z", "updated_at": "2022-02-16T18:22:17.524911Z" } -
django not saving media files in production
I set up django project on ubuntu 18.04 and apache2 but there is a problem. Media files don't save. When I try to upload file using django-filer I get 500 internal server error(I wrote simple plugin with charfield and filefield - the same happens) independently from DEBUG=True/False setting. I uploaded few files using manage.py runserver and this works great - I can even use these files in production but an attempt to upload any new one cause error settings.py: MEDIA_URL = '/media/' MEDIA_ROOT = '/mysite/public/media/' STATIC_URL = '/static/' STATIC_ROOT = '/mysite/public/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR,'static')] apache configuration: alias /static /mysite/public/static <Directory /mysite/public/static> Require all granted </Directory> alias /media /mysite/public/media <Directory /mysite/public/media> Require all granted </Directory> <Directory /mysite/src/proj> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess mysite python-home=/mysite/venv python-path=/mysite/src/ WSGIProcessGroup mysite WSGIScriptAlias / /mysite/src/proj/wsgi.py In conclusion: manage.py runserver works great. On production server I can manage files which were uploaded earlier but an attempt to upload a new one cause error 500. -
docxtemplater in Vue js error Failed to read responseText on android
I have created a frontend app with Vue js on the Quasar framework, it works very well on the browser. But when I run it on android by using Cardova it does not work properly when it loads an MS word file from a remote server to fill it with some data. For templating I am using docxtemplater. And I take the following error: Error: InvalidStateError: Failed to read the 'responseText' property from 'XMLHttpRequest': The value is only accessible if the object's 'responseType' is '' or 'text' (was 'arraybuffer'). In addition, I have used Django as a server.