Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Custom QuerySet for a Django admin action
# Customers model Customers(models.Model): name = models.CharField(max_length=255) emails = ArrayField(models.EmailField(), default=list, blank=True) ... ... ... I have a QuerySet which has all the information according to model of all the selected customers. # Django admin action def get_email_ids(self, request, queryset): """ QuerySet here is all the information according to model of all the selected customers. """ # new_queryset = ? return generate_csv( request, queryset, filename="email-ids.csv", ) I want a new custom QuerySet which only has the customer name and email id's. But it should be in the following way. If a customer has 10 email id's then there should be 10 rows for that customer in the QuerySet. e.g. customer1 email1@email.com customer1 email2@email.com customer1 email3@email.com customer1 email4@email.com customer2 emailother@email.com How to achieve this for new_queryset? -
keyword base Elastic Search Query
what changes i have to do in this query to searching. I'm working on open-edx project with django (python) and i want to implement elastic search in this project. I want to search courses by it's incomplete name like if there Robotics named courses will be find out if i only search ro, rob, robo, robot etc.... please help me ! enter: if search_term: filters = True search_result = searcher.search(search_term,field_dictionary=match_field_dict,size=20,from_=20*(int(page) if page else 0)) else: search_result = searcher.search(field_dictionary=match_field_dict,size=20,from_=20*(int(page) if page else 0)) [api.py file][1] [result1][2] [result2][3] [1]: https://i.stack.imgur.com/JhfW7.png [2]: https://i.stack.imgur.com/KpKb1.png [3]: https://i.stack.imgur.com/peiF2.png -
Django - List all objects that have one object as related field
I want to do something similar to the screen that shows in the Django admin panel when you are going to delete an object. The difference is that that screen shows every object that would be deleted because of the CASCADE effect. I would also like to get every object that has it related to SET_NULL or whatever option. The use case that I have is: lets say we have the tipical Author / Book class definitions (but with many more objects that have Author as a foreign key). Now we have two Author objects that we want to merge into one of them only because the second one is a variation with wrong information. I want to be able to say to every object that was the wrong author object to relate to the correct one before deleting the bad one. I know I can do it manually checking every model that has Author as foreign key and updating it. But is there a built-in function or similar to get all at once? -
Errors in Migrating models
Having errors in trying to migrate models(makemigrations command). Errors in classes Cart and Product. Here's the code: class Cart(models.Model): type_status = (('Pending'), ('Ongoing'), ('Delivered')) type_payment = (('Yes'), ('No')) cart_id = models.AutoField(primary_key=True) status = models.CharField(max_length=1, choices=type_status) payment_paid = models.CharField(max_length=1, choices=type_payment) totalAmount = models.FloatField() class Product(models.Model): item_id = models.ForeignKey(Admin, on_delete=models.CASCADE) itemName = models.ForeignKey(Admin, on_delete=models.CASCADE) price = models.FloatField() ERRORS: registration.Cart.payment_paid: (fields.E005) 'choices' must be an iterable containing (actual value, human readable name) tuples. registration.Cart.status: (fields.E005) 'choices' must be an iterable containing (actual value, human readable name) tuples. registration.Product.itemName: (fields.E304) Reverse accessor 'Admin.product_set' for 'registration.Product.itemName' clashes with reverse accessor for 'registration.Product.item_id'. HINT: Add or change a related_name argument to the definition for 'registration.Product.itemName' or 'registration.Product.item_id'. registration.Product.item_id: (fields.E304) Reverse accessor 'Admin.product_set' for 'registration.Product.item_id' clashes with reverse accessor for 'registration.Product.itemName'. HINT: Add or change a related_name argument to the definition for 'registration.Product.item_id' or 'registration.Product.itemName'. -
DRF: Integer expected but received String (using Axios)
I receive the following error when i try to send an array of id's to the django rest framework: My payload looks like: assigned_facilities: 1,2 When i using the drf api test page it works and the payload looks like this: assigned_facilities : [1, 2] So my assumption is that i'm missing the brackets and thats why it isn't working? How do i fix that? const cpBoard = useSelector((state) => state.cpBoard); const facilityIds = (cpBoard.cpBoardItems?.map(cpBoardItem => (cpBoardItem.id))); function submitFacilities() { const facilitydata = new FormData() facilitydata.append("assigned_facilities", facilityIds); axios.patch(API.leads.update(id), facilitydata, { headers: { "Authorization": `Bearer ${accessToken}`, 'Content-Type' : 'application/x-www-form-urlencoded', 'Accept' : 'application/json', }, withCredentials: true, }) .then(res => { setLead(res.data) }) .finally(() => { setLoading(false) }) } -
Submitting two forms with ajax independently with Django
Im trying to submit two POST forms with Django using ajax, but just one of the forms has the method POST in it. I dont really know what to do here, the error is probably in the Javascript, but i dont see why the first form submit with POST method and the second doesn't, i tried to search in the internet but i think i didnt search the right question. (sorry for my bad english) views.py import os import time from datetime import datetime from django.http import HttpResponse, StreamingHttpResponse from django.shortcuts import render from utils.camera_streaming_widget import CameraStreamingWidget # Camera feed def camera_feed(request): stream = CameraStreamingWidget() frames = stream.get_frames() return StreamingHttpResponse(frames, content_type='multipart/x-mixed-replace; boundary=frame') def detect(request): stream = CameraStreamingWidget() success, frame = stream.camera.read() if success: status = True else: status = False return render(request, 'detect_barcodes/detect.html', context={'cam_status': status}) def dados(request): if request.method == 'POST': name = request.POST['name'] print('HELLO') return HttpResponse(name) def dados_cod(request): if request.method == 'POST': cod = request.POST['cod'] print(cod) return HttpResponse(cod) html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" ></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <title>Detect Barcodes</title> <style type="text/css"> .navbar-brand { font-size: xx-large; } </style> </head> <body> <nav class="navbar navbar-expand-lg navbar-light" style="background-color: #3c8f56;"> <div … -
How to erase/delete/wipe the migration history in Django
I'm experimenting with varios django modells and settings. I can't erase the migration history which is make me upset. I have run this script and physically delete all .pyc files and the database. del /s /q *.pyc del /q db.sqlite3 After i typed: python manage.py makemigrations and i have got this: No changes detected I tired this as well: python manage.py migrate --fake-initial no luck. Any idea please! Thank you. -
Django template vs React
I am asked to build a mid-sized CRM using python, but I am not sure what to use to build that. Here are my questions: Should I follow the SPA approach? Should I use Django template or it is better to use Django REST framework to transmit the data as JSON to/from React? If it is better to use REST, is there any benefits of using Django over other Python web development frameworks like flask? -
Users erratically getting CancelledError with Django ASGI
Our users are erratically getting CancelledError for any page in our system. The only pattern we’ve observed is that this happens more often for pages which take more time to load during normal operation. But it is absolutely not limited to such pages, it can happen anywhere in our system, e.g. login page. All of the affected pages do not use any async code or channels, they’re standard django views working in request/response model (we migrated to ASGI only recently and we only have a single page which uses channels and it works just fine). We cannot reproduce it consistently. What we see in sentry.io: CancelledError: null File "channels/http.py", line 198, in __call__ await self.handle(scope, async_to_sync(send), body_stream) File "asgiref/sync.py", line 435, in __call__ ret = await asyncio.wait_for(future, timeout=None) File "asyncio/tasks.py", line 414, in wait_for return await fut Locally and in Daphne logs it look like it: 2022-10-12 20:00:00,000 WARNING Application instance <Task pending coro=<ProtocolTypeRouter.__call__() running at /home/deploy/.virtualenvs/…/lib/python3.7/site-packages/channels/routing.py:71> wait_for=<Future pending cb=[_chain_future.._call_check_cancel() at /usr/lib/python3.7/asyncio/futures.py:348, <Task WakeupMethWrapper object at 0x7f1adcbf9610>()]>> for connection <WebRequest at 0x7f1adcc6bb50 method=POST uri=/dajaxice/operations.views.calculate_cost_view/ clientproto=HTTP/1.0> took too long to shut down and was killed. 2022-10-12 20:00:00,000 WARNING Application timed out while sending response From the user’s POV, the page simply … -
How to allow UpdateView only to a user that owns that model - and that model is already connected with a foreign key
I want the Topping model to only be accessible to a current user, and not to other users who could access that page by copying the URL. models.py class Pizza(models.Model): name = models.CharField(max_length=20) owner = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.name def get_absolute_url(self): return "/pizzas" class Topping(models.Model): pizza = models.ForeignKey(Pizza, on_delete=models.CASCADE) name = models.CharField(max_length=20) def __str__(self): return self.name def get_absolute_url(self): return reverse("pizza", kwargs={"pizza_id": self.pizza.pk}) views.py class UpdateTopping(LoginRequiredMixin, UpdateView): model = Topping form_class = UpdateToppingForm template_name = "pizzas/update_topping.html" Something along these lines (this has worked on the primary model): class UpdatePizza(LoginRequiredMixin, UpdateView): model = Pizza form_class = UpdatePizzaForm template_name = "pizzas/update_pizza.html" def get_queryset(self): base_qs = super(UpdatePizza, self).get_queryset() return base_qs.filter(owner=self.request.user) -
How to invoke a function when superadmin changes attributes from admin panel?
I wanted to send a notification to the user (or invoke any function in that case) if the attribute of the object is changed (For eg, an attribute ‘is_checked’ is changed to True) from the admin panel. Upon digging through the Django source code, I found the log entry class that is used in the admin panel. def check_state_change(): logs = models.LogEntry.objects.all() for log in logs: if log.action_flag == 2: if log.change_message == “[‘is_checked’]”: function(*object whose attribute was changed*) for now I am checking all the logs The above function does the job but I am unsure about the ways to invoke this function. Do I call it every 5mins or what are the better ways? -
Comment on multiple post objects on a single page using jQuery ajax in Django
I've been trying to implement a comment function with jQuery ajax in Django to allow me comment on multiple post object on a single page, but somehow I have a challenge figuring why I am getting the same comment repeated in other other post object comments, when commenting on a first post i sent the comment to the database without any issues but when I try comment on a second post on the same page it repeats the first comment for the second post on the same page, even thought the comment doesn't relate to that post object. To be clear why is ajax repeating my comment for other post object and if I refresh the post and try comment on another post object it send an empty post to the database how do I resolve this situation as when I comment on the first object it works fine but the when I try with the second post object it just repeat the first comment for the second post object. My view for comment def feedComment(request): if request.method == 'GET': post_id = request.GET['id'] comment = request.GET['comment_text'] post_obj = Post.objects.get(id=post_id) create_comment = Comment.objects.create(post=post_obj, username=request.user, comment=comment) create_comment.save() return JsonResponse({'comment':create_comment.comment,}) my ajax function … -
Is there any way to show the records in view mode when clicking the edit when it has fully billed status in Netsuite Suitescript 2.0
function beforeLoad(context){ var Type = context.type;if(Type== context.UserEventType.EDIT && Status=='fullyBilled'){ var form = context.form; return redirectUrl = url.resolveRecord({ recordType: 'purchaseorder', isEditMode: false }); } } -
How to make funtion call in Django views.py to render same template but with different queries?
class CartView(View): def get(self,request,pk): if request.user.is_authenticated: if Smart_phone.objects.filter(name=pk): product = Smart_phone.objects.filter(name=pk) items = product for item in items: if item.instock>0 : context ={'product':product} return render(request,'customer_purchase/cart.html',context) else: return render(request,'customer_purchase/home') elif Tabs.objects.filter(name=pk): product = Tabs.objects.filter(name=pk) items = product for item in items: if item.instock>0 : context ={'product':product} return render(request,'customer_purchase/cart.html',context) else: return render(request,'customer_purchase/home.html') elif Smart_watch.objects.filter(name=pk): product = Smart_watch.objects.filter(name=pk) items = product for item in items: if item.instock>0 : context ={'product':product} return render(request,'customer_purchase/cart.html',context) else: return render(request,'customer_purchase/home') else: return redirect('login') Here the loop is common for every query . Hence i want to call a function ,that does the rendering process . 'instock' is a field common to the models thats i am using here -
Running my Django site on pythonanywhere on my local machine
I've set up a basic Django server on Pythonanywhere, then I downloaded all of those files on my local machine. (the linking between the python-anywhere cloud server and my local machine is done via Git using pull & push commands) If I were to run on my computer, how should I approach this? Do I download django from pip and turn on virtual environment and run it there? I am just a bit confused. Since I don't know a whole lot about what's going and what webserver I am using on Pythonanywhere, I don't exactly how to run it on my local machine. I also saw in Pythonanywhere's docs not to run the runserver command. Is it even okay running it on my local machine? It won't change anything in the file themselves, right? -
How to auto-populate field in Django admin based on another fields value
I want to make a dependent auto-populate field which get populated with custom values when another field is selected by the user. I have searched but was not able to find the correct help. My case I want when the fertiliser name is selected the above field "phosphate" etc. should get populated based on the fertiliser name selected. -
Why does my django app keep givin me "getattr(): attribute name must be string" error?
How do I get default image as argument in creating a profile? My django keeps getting me error highlighting me getting User and me trying to use image. this is part of views.py in question user = User.objects.create_user(request.POST['username'], email=request.POST['email'], password=request.POST['password1']) user.is_active = False user.save() url = static('default-pfp.jpg') profile = Profile.objects.create(owner=user, profilePicture=url) This is lines I get highlighted in error TypeError at /profile/signup/ getattr(): attribute name must be string 1. profile = Profile.objects.create(owner=user, profilePicture=url) 2. user = User.objects.get(username=request.POST['username']) My static picture is located in static/blog/default-pfp.jpg. I also tried adding blog/ in my url. Im also using a docker and nginx here -
Does Django not support Jinja manual whitespace control?
I am trying to use the Jinja manual whitespace control inside a Django template {% if condition -%} {{ my_variable }} {% endif %} and get TemplateSyntaxError Could not parse the remainder: '-' from '-' Django version is 3.2, Jinja 3.1. Is this not supported? I see there is django-whiteless that might address this issue. -
Django - Not passing id from template to views
In my ToDoApp, I couldn't send the ID to my function. Not sure what mistake I'm making. Seems my function is correct because when I tested the form action with "datechange/1". It worked. Here is my code: Index.html {% extends 'base.html' %} {% block content %} <h3 style = "margin-bottom: 20px"><strong>To Do List App</strong></h3> <form method="POST" action="datechange/{{task.id}}"> {%csrf_token%} <ul class="list-group"> {% for task in tasklist %} <li class="list-group-item d-flex justify-content-between align-items-center"> <input type='hidden' name = {{task.id}}>{{task.tasks}} <span class="badge bg-primary rounded-pill">{{task.duedate}} <input type="date" name="datepick"/> <input type='submit' value = 'Update'> </span> </li> {% endfor %} </form> Views.py def index(request): tasklist = Task.objects.all() return render(request, 'index.html', {'tasklist':tasklist}) def datechange(request,id): # taskid = request.POST.get(id='task.id') # task = Task.objects.get(id=taskid) task = Task.objects.get(id=id) datepick = request.POST.get('datepick') task.duedate = datepick task.save() return HttpResponseRedirect(reverse('index')) Urls.py from django.contrib import admin from django.urls import path from . import views urlpatterns = [ path('admin/', admin.site.urls), path('',views.index,name='index'), path('datechange/<int:id>',views.datechange,name='datechange'), ] -
bootstrap filter-control doesn't work with server-side pagination
I've been trying to make the bootstrap filter-control select work with server-side pagination, however, selecting an option from the dropdown merely returns the initial table and not the table that contains the column with the data that I've selected. I know that the server-side pagination is causing this because if I use client-side pagination the filter-control works as intended. I also tried using data-disable-control-when-search as documentation states to use this whenever the filter-control is used alongside server-side pagination, but the problem persists. <table class="table table-borderless table-hover" data-side-pagination="server" data-disable-control-when-search="true" data-toggle="table" data-search="true" data-filter-control="true" data-click-to-select="true" data-pagination="true" data-pagination-loop="false" data-page-size="10" data-show-refresh="true" data-icons-prefix="fa" data-icons="icons" data-buttons-class="yellow" data-mobile-responsive="true" data-loading-font-size="14px" data-url="{% url "app:api/negotiations/all" %}"> <thead> <tr> <th data-field="request.short_code" data-searchable="false">{% translate "Request ID" %}</th> <th data-field="offer.short_code" data-searchable="false">{% translate "Offer ID" %}</th> <th data-field="request.sender.full_name" data-searchable="false">{% translate "Sender Name" %}</th> <th data-field="offer.traveller.full_name" data-searchable="false">{% translate "Traveller Name" %}</th> <th data-field="request.origin" data-searchable="true" data-filter-control="select">{% translate "Origin" %}</th> <th data-field="request.destination" data-searchable="true" data-filter-control="select">{% translate "Destination" %}</th> <th data-field="status" data-formatter="statusFormatter" data-searchable="false">{% translate "Status" %}</th> <th data-field="offer.departure_date" data-searchable="true" data-filter-control="select">{% translate "Date of Departure" %}</th> <th data-field="offer.arrival_date" data-searchable="true" data-filter-control="select">{% translate "Date of Arrival" %}</th> <th data-field="is_reported" data-searchable="false" data-formatter="reportedFormatter" data-align="center">{% translate "Reported" %}</th> <th data-field="update_url" data-searchable="false" data-formatter="actionFormatter" data-align="center">{% translate "Action" %}</th> </tr> </thead> </table> -
Django Entity Relationship Diagram models problem
so i am learning django & have a diagram to write models using it. here is the diagram picture but the site gives me error when i submit my answer(models). the Bold fields are ForeinKey or PrimaryKey. i dont have to write the dim colored fields. and the italic ones should be inherited. this is my code: charities/models.py : from django.contrib.auth.models import AbstractUser from django.db import models class User(AbstractUser): is_active = models.BooleanField(AbstractUser, default=True) is_staff = models.BooleanField(AbstractUser, default=False) is_superuser = models.BooleanField(AbstractUser, default=False) and accounts/models.py : from django.db import models from ..accounts.models import User class Benefactor(models.Model): EXP_CHOICES = ( ('0', 'Beginner'), ('1', 'average'), ('2', 'expert') ) user = models.OneToOneField(User, on_delete=models.CASCADE) experience = models.SmallIntegerField(null=True, blank=True, choices=EXP_CHOICES, default='0') free_time_per_week = models.PositiveSmallIntegerField(null=True, blank=True, default=0) class Charity(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) name = models.CharField(max_length=50, null=True, blank=True) reg_number = models.CharField(max_length=10, null=True, blank=True) class Task(models.Model): STATE_CHOICES = ( ('P', 'Pending'), ('W', 'Waiting'), ('A', 'Assigned'), ('D', 'Done'), ) assigned_benefactor = models.ForeignKey(Benefactor, null=True, on_delete=models.SET_NULL) charity = models.ForeignKey(Charity, on_delete=models.CASCADE) state = models.CharField(max_length=1, choices=STATE_CHOICES, default='P') title = models.CharField(max_length=60) what is the problem of my code guys? trying to solve it around 4 days and havent got anywhere. help me please. thanks. -
Connect/Authenticate Django Web App on SQL server using Key Vault, Azure AD or other (not using user-pass on my code)
I have Django web app, with an SQL server db, deployed on my Azure subscription. I need to connect/authenticate my Web App to SQL server (still on my Azure subscription) but I can't using username-password on my code. How can I do it? By key vault? By Azure AD? Thanks! -
static file not upleaded
I am using React inside Django app and facing issue of not loading static file my settings.py is from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-00cag42gtk)0_9#kn_8c3d1y-u!et#kqpa3@(i^bo@j@z#1jn9' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'leads.apps.LeadsConfig', 'rest_framework', 'frontend' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'leadmanager.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], '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', ], }, }, ] WSGI_APPLICATION = 'leadmanager.wsgi.application' # Database # https://docs.djangoproject.com/en/4.0/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ STATIC_URL … -
Forbidden (CSRF cookie not set.): /login/ REACT & DJANGO
I have built the frontend with react and backend with django and everything works fine on localhost but when I deployed the frontend on heroku and made a POST request to login (backend running on localhost still)I got the following error: Forbidden (CSRF cookie not set.): /login/ Front end code: https://pastebin.com/CHArh4JL function getCsrf(){ fetch("http://localhost:8000/csrf/", { credentials: "include", }) .then((res) => { let csrfToken = res.headers.get("X-CSRFToken"); setCsrf({csrf: csrfToken}); }) .catch((err) => { console.log(err); }) } const login = (event) => { event.preventDefault(); setIsLoading(true) fetch("http://localhost:8000/login/", { method: "POST", headers: { "Content-Type": "application/json", "X-CSRFToken": csrf.csrf, }, credentials: "include", body: JSON.stringify({username: username, password: password}), }) .then(isResponseOk) .then((data) => { console.log(data); setIsAuthenticated(true) localStorage.setItem("authenticated", true); setUsername('') setPassword('') setIsLoading(false) // this.setState({isAuthenticated: true, username: "", password: ""}); }) .catch((err) => { console.log('inside login catch') console.log(csrf.csrf, 'catch') console.log(err); }); } const isResponseOk = (response) =>{ if (response.status >= 200 && response.status <= 299) { return response.json(); } else { console.log(response) throw Error(response.statusText); } } useEffect(() => { //getSessions setIsLoading(true) fetch("http://localhost:8000/session/", { credentials: "include", }) .then((res) => res.json()) .then((data) => { // console.log(data); if (data.isAuthenticated) { setIsAuthenticated(true) console.log(data) } else { // test() setIsAuthenticated(false) console.log(data) getCsrf() } setIsLoading(false) }) .catch((err) => { console.log(err); }); }, []) backend code: https://pastebin.com/sXv1AWhK @require_POST … -
How to use an external project in my current project in VS code?
I have a python project in VS code and I run it locally. I want to link and connect my project to another project (the second project is cloned from git hub). I mean I want to have a link in the output of my first project (web application) which is linked to the second project. I cloned second project in the folder of the first project. I want to have the output of two projects together. I am confused now, and I don't know what should I do or from which file I should start to link them.