Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how can I implement AJAX when i need to return a stored procedure function result in my views.py?
Im trying to implement ajax with a django app, specially with a view where I call a stored procedure to return a result -
Django, different result between `all()` method and `all().values()` method
I am facing this problem, where i can't access the url of some image using values() method, but it still can be accessed if it is a queryset object rather than a pythonic list: class MyModel(models.Model): img = models.ImageField(upload_to='media') # the image is stored in aws, hence it will produce a url def __str__(self): return f"{self.img.url}" this is example model, now let's try printing that on the shell: >>models.MyModel.objects.all() <QuerySet[{'img':'https://aws/bucketlist.com/some_img.png'}]> however with values() method: >>models.MyModel.objects.all().values() <QuerySet[{'img':'media/some_img.png'}]> ``` as you can see with `values()` i get the local path rather than the url to the aws cloud note that aws storage is set correctly in django. settings.py: DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') CKEDITOR_UPLOAD_PATH = "/media" AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID') AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY') AWS_STORAGE_BUCKET_NAME = os.environ.get('AWS_STORAGE_BUCKET_NAME') AWS_S3_FILE_OVERWRITE = False AWS_DEFAULT_ACL = None DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage' AWS_S3_REGION_NAME = "ap-southeast-2" AWS_S3_ADDRESSING_STYLE = "virtual" however, images are appearing on AWS and it seem to be fine on the cloud side. -
Alternatif to CSRF in Django
I run an Django app inside an iframe which is with php hosted on another server. All works except the POST request, I got error in Firefox only: Request failed with status code 403 > CSRF verification failed > CSRF cookie not set Previously i had Sameside warning which i solved by allowing Samesite secure in php script: PHP: ini_set('session.cookie_httponly',1); ini_set('session.use_only_cookies',1); $cookieParams = session_get_cookie_params(); $cookieParams[samesite] = "None"; $cookieParams[secure] = true; session_set_cookie_params($cookieParams); session_start(); Warning gone but sill cookie not passing over iframe, but present in Chrome. So i think i could skip the cookie then send it via Axios because i use Axios to send the request: JS: axios.defaults.xsrfCookieName = 'csrftoken'; axios.defaults.xsrfHeaderName = "X-CSRFTOKEN"; const config = { headers: { 'method':'POST', 'accept': '*/*', 'content-type': 'application/json;charset=UTF-8', withCredentials: true, 'X-CSRFTOKEN': window.csrf_token, //csrfmiddlewaretoken: window.csrf_token } }; axios.post(url, datas, config).then((res) => {.... Settings.py: CSRF_TRUSTED_ORIGINS = ['https://myPhpsite.com', 'myPhpsite.com'] CSRF_COOKIE_SAMESITE = 'None' CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True SESSION_COOKIE_SAMESITE = 'None' CORS_ALLOW_CREDENTIALS = True After tying many things i'm thinking to disable the csrf by commenting 'django.middleware.csrf.CsrfViewMiddleware',. If I do it, is it an alternatif to csrf in order to get protected like csrf provide? -
How to design a database to make correction documents for sales invoices
How (simplified) to design a database/models to make correction documents for sales invoices? class Product(models.Model): title = models.CharField(max_length=50) class Invoice(models.Model): title = models.CharField(max_length=50) class InvoiceItem(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) quantity = models.DecimalField(max_digits=5, decimal_places=2) class InvoiceCorrectionNote(models.Model): document = models.ForeignKey(Invoice, on_delete=models.CASCADE) class InvoiceCorrectionItem(models.Model): item = models.ForeignKey(InvoiceItem, on_delete=models.CASCADE) document = models.ForeignKey(InvoiceCorrectionNote, on_delete=models.CASCADE) original_quantity = models.DecimalField(max_digits=5, decimal_places=2) quantity_after_correction = models.DecimalField(max_digits=5, decimal_places=2) -
Attempting to read pk from url in django, but getting error NoReverseMatch at /
I am attempting to insert a link into my navbar (header.html - which is included in my base.html) which leads to the users profile. In order to provide the profile of the user who is currently logged in, I am attempting to use a primary key via the url. However, I am receiving the following error message: Reverse for 'url' with keyword arguments '{'pk': ''}' not found. 1 pattern(s) tried: ['profiles/show/(?P[0-9]+)/\Z'] I have a Profile model defined (shown below) with a OneToOne Relationship to my User model. I am wondering if I am trying to parse in the wrong pk reference in my header.html file. If so I think the issue will be on line 17 "Show Profile", but may also be in my view file? Something is definitely going wrong with my primary key, but am new to Django and cant work out what it is! Model: class Profile(models.Model): # Get access to create profile by default MALE = 'M' FEMALE = 'F' OTHER = 'O' UNSPECIFIED = "U" GENDER_CHOICES = [ (MALE, 'Male'), (FEMALE, 'Female'), (OTHER, 'Other'), (UNSPECIFIED, 'Prefer not to say'), ] user = models.OneToOneField(User, on_delete=models.CASCADE) phone_number = models.CharField(verbose_name='Mobile Phone Number', max_length=20) bio = models.TextField(verbose_name='Bio', max_length=500, blank=True, … -
Django's RSS framework having a AmbiguousTimeError:
I am on an old system using Django 1.8 and pytz 2013.9. We're using RSS and stumbled on a AmbiguousTimeError because of the following date: 2022-11-06 01:55:41.107437. It is an ambiguous time and turns out to haven at django.utils.timezone.make_aware: timezone.localize(value, is_dst=None) Since it's an ambiguous time and the source code is explicitly passing no DST, it can't figure out the date (shouldn't the framework figure out whether DST is applied or not through the timezone object?) This make_aware function is, in turn, also called from Django's RSS framework in django.contrib.syndication.Feed.get_feed. The timezone is: <DstTzInfo 'America/Los_Angeles' PST-1 day, 16:00:00 STD> How can I deal with this? The issue lies at the source code. I tried upgrading the package and it doesn't help. I am not able to upgrade Django (large upgrade process pending). -
Django get which models are children of this model
I want to know what models are children of a model. As I know like below if we have ownerModel which is parent of childModel1 and check1Model: import uuid from django.db import models class ownerModel(models.Model): ownerId = models.UUIDField(default=uuid.uuid4, unique=True, primary_key=True, editable=False, blank=True) class check1Model(models.Model): checkId = models.UUIDField(default=uuid.uuid4, unique=True, primary_key=True, editable=False, blank=True) owner=models.ForeignKey(ownerModel,on_delete=models.CASCADE) class childModel1(models.Model): childId = models.UUIDField(default=uuid.uuid4, unique=True, primary_key=True, editable=False, blank=True) check2=models.ForeignKey(ownerModel,on_delete=models.CASCADE) then we can get what models are children of ownerModel with a code like this: class myView(views.APIView): def get(self, request, format=None): for f in ownerModel._meta.get_fields(): if 'field' in f.__dict__.keys(): print('***childModels***') print(f.__dict__) print() return Response({'0000'}, status=status.HTTP_200_OK) I mean by checking if the field key is in __dict__.keys() in items of ownerModel._meta.get_fields() ofc so like here we get extended info about children models: ***childModels*** {'field': <django.db.models.fields.related.ForeignKey: owner>, 'model': <class 'Users.models.ownerModel'>, 'related_name': None, 'related_query_name': None, 'limit_choices_to': {}, 'parent_link': False, 'on_delete': <function CASCADE at 0x00000286550848B0>, 'symmetrical': False, 'multiple': True, 'field_name': 'ownerId', 'related_model': <class 'Users.models.check1Model'>, 'hidden': False} ***childModels*** {'field': <django.db.models.fields.related.ForeignKey: check2>, 'model': <class 'Users.models.ownerModel'>, 'related_name': None, 'related_query_name': None, 'limit_choices_to': {}, 'parent_link': False, 'on_delete': <function CASCADE at 0x00000286550848B0>, 'symmetrical': False, 'multiple': True, 'field_name': 'ownerId', 'related_model': <class 'Users.models.childModel1'>, 'hidden': False} so I find these 2 conditions necessary to get child models info: in child models … -
Django query from multiple table base on FK
hi i am new in django coding i have 3 tables(models) in my different Django app , i try to make a simple report in htmpl page , so need to retrive specific data for each item base on foreign key. by below code i can accress machine stored table in Html page by making a loop , but i want to fetch data from other table and filter them , `{% for m in machines %} {{m.title}} {{}}. //i** need to access the ordertitle field in tb_order base on machine id. ??** {{ }}. // **access ordertitle in tb_order base on status field ??** {%end for %}` here is a **view.py ** `def allmachinesLOGO(request): machines=Machine.objects.all() context ={'machines':machines} return render(request,'pline/machineslogos.html',context)` **Models : ** class tb_order(models.Model): ordertitle= models.CharField(max_length=200) customer=models.ForeignKey(Customer, null=True, on_delete=models.SET_NULL) mould=models.ForeignKey(Mould, null=True, on_delete=models.SET_NULL, blank=True) status=models.CharField(choices=status_choices, default="0", max_length=20) accept=models.BooleanField machine=models.ForeignKey(Machine,null=True, on_delete=models.SET_NULL, blank=True) id =models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False, unique=True) class Machine(models.Model): title = models.CharField(max_length=200) machine_model = models.CharField(max_length=200, null=True, blank=True) description = models.CharField(max_length=600, null=True, blank=True) featured_image=models.ImageField(default="defaultmachine.webp", blank=True, null=True) id=models.UUIDField(default=uuid.uuid4, unique=True,primary_key=True,editable=False) advice a solution access ordertitle in tb_order base on status field ?? //** i need to access the ordertitle field in tb_order base on machine id. ??** -
Pass request user's username to Serializer from Viewset in Django Rest Framework
I want to pass the username of the logged in user from ListCreateAPIView to ModelSerializer to use object with same PrimaryKey from Clients model as a default, but i don't understand how to do it correctly. In views.py: class CartAPIList(generics.ListCreateAPIView): queryset = Clientcarts.objects.all() serializer_class = CartSerializer permission_classes = (IsAuthenticatedOrReadOnly, ) In serializers.py: class CartSerializer(serializers.ModelSerializer): client_id = serializers.HiddenField(default=Clients.objects.get(pk="username")) class Meta: model = Clientcarts fields = '__all__' Can you guys help me? -
how to select some value from multiple table in Django?
I want to to select some students from table A where students username and class code are not inside table B. So it will show all student that not inside the student class list yet. the query was like SELECT students from TableA WHERE username NOT IN tableB AND classcode = CODE models.py class modelStudentclassss m(models.Model): classcode = models.CharField(max_length=200, null=False, blank=False) username = models.CharField(max_length=200, null=False, blank=False) class modelUser(models.Model): username = models.CharField(max_length=200, null=False, blank=False) views.py studentclass = modelStudentclass.objects.all() studentdata = modelUser.objects.exclude(studentusername = studentclass.username).filter(role="student", classcode=classcode) -
Django TestCase doesn't rollback DB when atomic transaction fails
I need help with writing a unit test that tests atomic transactions I'm simply writing code that transfers money from a sender account to a receiver account by decreasing the amount of money from the sender and adding it to the receiver. I want to run the code in an atomic transaction because I want it to either all succeed or all fail. I want to write a test case that verifies that if the deposit function fails, the withdrawal should also be rolled back and the balance of the sender should stay the same. The problem is that the test case fails as it shows that the sender balance is decreased although it should be rolled back. Any help? here's a small snippet of what I want to achieve import pytest from cards.models import Card, Account from unittest.mock import patch def perform_atomic(txn, sender_account, receiver_account, amount): try: with transaction.atomic(): sender_account.balance -= 1000 sender_account.save() receiver_account.deposit(amount) except Exception as error: txn.status = Transaction.TRANSACTION_STATUS_FAILED txn.save() logger.error(f"Failed Action. Reason[{error}]", exc_info=True) raise error # Test case @patch.object(Account, "deposit") def test_atomicity_when_deposit_fails(self, deposit_mock): deposit_mock.side_effect = ValidationError("deposit failed") self.sender_account.balance = 300.0 self.sender_account.save() # Balance before attempting to transfer before_sender_balance = self.sender_account.balance with pytest.raises(ValidationError, match="deposit failed"): perform_atomic(self.transaction, self.sender_account, self.receiver_account, … -
Django custom form - cleaned_data has incorrect values for IntegerField
In my Django app (v. 3.1), I've added a custom form to trigger a data export that, among other things, can collect two integer values that represent years in a date range. When the form is submitted, no matter what values the user has set in the number fields, the values that appear in the form's cleaned_data attribute are the values that were set as initial for those fields on the definition of the form class. For example, the initial value of the field should be 2022 - but no matter what value the user sets in the input, the value in form.cleaned_data for the field is 2022. A ChoiceField in the form works as expected, and I'm pretty inexperienced with Django - so I can't quite figure out what I've done wrong here. Here's a slightly simplified version of the code... observation/forms.py: from django import forms import datetime export_formats = [ 'csv', 'xls', 'xlsx', ] export_format_choices = [(f, f) for f in export_formats] min_year = 1950 class ExportForm(forms.Form): current_year = datetime.datetime.now().year export_format = forms.ChoiceField(required=True, label='Format', choices=export_format_choices) year_from = forms.IntegerField(required=False, disabled=True, min_value=min_year, max_value=current_year, initial=current_year) year_through = forms.IntegerField(required=False, disabled=True, min_value=min_year, max_value=current_year, initial=current_year) def __init__(self, *args, **kwargs): super(ExportForm, self).__init__(*args) admin.py def export_view(self, … -
TypeError: Cannot read properties of undefined (reading 'forEach') with ajax method
I have ajax funtion: <div class="quiz-box"></div> ... const url = window.location.href const quizBox = document.getElementById('quiz-box') let data $.ajax({ type: 'GET', url: `${url}data/`, success: function(response){ // console.log(response) data = response.data data.forEach(el => { for (const [question, answers] of Object.entries(el)){ quizBox.innerHTML = ` <b>${question}</b> ` } }); }, error: function(error){ console.log(error) }, }) Which gets data from django view. Now this results in an error in console: Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') at Object.success at j at Object.fireWith [as resolveWith] at x at XMLHttpRequest.b Why is this error occuring and how can I prevent this? -
Page not found (404) No x matches the given query
I'm not sure of why I can't get the pk which I think it's the problem here. I am trying to do a like functionality to a product model, with a like the page would refresh and the result be shown but it does not save the like and the error Page not found (404) No Product matches the given query. My Model: class Product(models.Model): author = models.ForeignKey(User, default=None, on_delete=models.CASCADE) title = models.CharField(max_length=120, unique=True) likes = models.ManyToManyField(User, related_name='like') ... def number_of_likes(self): return self.likes.count() My views: class ProductDetailView(DetailView): model = Product template_name = 'services/product_detail.html' def get_context_data(self, **kwargs): data = super().get_context_data(**kwargs) likes_connected = get_object_or_404(Product, id=self.kwargs['pk']) liked = False if likes_connected.likes.filter(id=self.request.user.id).exists(): liked = True data['number_of_likes'] = likes_connected.number_of_likes() data['post_is_liked'] = liked return data def ProductLike(request, pk): post = get_object_or_404(Product, id=request.POST.get('product_id')) if post.likes.filter(id=request.user.id).exists(): post.likes.remove(request.user) else: post.likes.add(request.user) return HttpResponseRedirect(reverse('product-detail', args=[str(pk)])) My urls: path('product/<int:pk>/', ProductDetailView.as_view(), name='product-detail'), path('product-like/<int:pk>/', ProductLike, name="product_like"), My template: {% if user.is_authenticated %} <form action="{% url 'product_like' object.id %}" method="POST"> {% csrf_token %} {% if post_is_liked %} <button type="submit" name="blogpost_id" value="{{object.id}}" >Unlike</button> {% else %} <button type="submit" name="blogpost_id" value="{{object.id}}">Like</button> {% endif %} </form> {% else %} <a href="{% url 'login' %}?next={{request.path}}">Log in to like this article!</a><br> {% endif %} <strong>{{ number_of_likes }} Like{{ number_of_likes|pluralize }}</strong> -
Django not authenticating users made using shell
In my project I have an existing legacy database, so I use inspectdb to create models and for specific requirements I am using custom user model No when I create a user directly in the DB using SQL commands then the user gets authenticate and is able to login, but when I create user using SHELL commands (model_name.objects.create()), then the user is not authenticated and is not able to login. and the main point, ** when I create user using SQL command password is stored in RAW form (non-encrypted), but when I create user using SHELL commands the password is encrypted and it looks like "pbkdf2_sha256---------------------------------" managers.py #managers.py class UsermanagementCustomUserManager(BaseUserManager): def create_user(self,emailid,firstname, password=None): """ Creates and saves a User with the given email, date of birth and password. """ if not emailid: raise ValueError('Users must have an email address') user = self.model( emailid=self.normalize_email(emailid), password=password, ) user.set_password(password) user.save(using=self._db) return user backends.py #backends.py from django.contrib.auth.backends import BaseBackend from django.contrib.auth.hashers import make_password,check_password from django.contrib.auth import get_user_model Usermanagement = get_user_model() class EmailAuthBackend(BaseBackend): def authenticate(self,request,username=None,password=None): # print("Custom authenticate rqst: ",request) try: print("Trying the email backend!") user = Usermanagement.objects.get(emailid=username) print("Got the user") # print(password) # print(user.password) # print(check_password(password)) # print(user.check_password(password)) if user.password == password or user.check_password(password): … -
JWT Token authentication in github social authentication in Django(Note: Use django allauth)
In a django project i created a user login using github social authentication by using django allauth. i want to implement JWT token authentication in it. How can i do it? If any one have any idea please share. -
Best way to organize search results by location in a Django Rest Framework backend?
There are some naive ways to do this but I was wondering whether there is a more proficient way to achieve this functionality. I have a django rest framework backend and a react native front end. I have a table with objects that includes an Address object with the object's street address. What I would like to do is to return results sorted by distance from the user. Right now the database is small but soon we may have to paginate results. I have a couple of ideas but I'm wondering whether there is a cleaner way to accomplish this. For example the address field contains a lat/lng portion that is currently left blank, one idea is to populate this field on create/update operations using the google maps API geocoding functionality, then when the user makes a search request we order by l2 distance from their coordinates. One issue is that this could become very inefficient as the table grows larger. If we need O(N log N) operations every time the user is at a different location - even using tricks like caching. I know that some larger companies shard their database over regions to help with overhead in situations … -
ImportError: cannot import name 'Item' from partially initialized module 'core.models' (most likely due to a circular import)
Now, this is being a nuisance. It used to work before but now all of a sudden, it shows me this error. I know what circular imports mean but this used to work before. Now, the 'product' field gives me the problem. from django.db import models from appsystem.models import Outlet from core.models import Item, Supplier from location.models import Warehouse, Zone, Section, Level class MainPurchases(models.Model): METHOD_A = 'CASH' METHOD_B = 'CREDIT' PAYMENT_METHODS = [ (METHOD_A, 'CASH'), (METHOD_B, 'CREDIT'), ] product = models.ForeignKey(Item, on_delete=models.PROTECT) quantity = models.PositiveSmallIntegerField() purchase_price = models.DecimalField(max_digits=6, decimal_places=2) paid_amount = models.DecimalField(max_digits=6, decimal_places=2) date_created = models.DateTimeField(auto_now_add=True) supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE) outlet = models.ForeignKey(Outlet, on_delete=models.CASCADE, blank=True, null=True) payment_method = models.CharField(max_length=6, choices=PAYMENT_METHODS, default=METHOD_A) -
"POST / HTTP/1.1" 201 91 handleChange function is not updating the object's state
I am creating aa react js and django app for my school project.I am creating a form component that has an image field in it.The value entered from form is required to be posted on the django rest framework api that has been created.But the state is not being updated by handleChange function in the react component Null values from initial state are getting posted.I am a newbie.Please help! Image.js this.state = { floor_no:null, distance:null, area:null, no_of_rooms:null, price:null, images: null }; this.handleChange=this.handleChange.bind(this); this.handleImageChange=this.handleImageChange.bind(this); } handleChange = (e) => { this.setState({ [e.target.id]: e.target.value }) }; handleImageChange = (e) => { this.setState({ images:e.target.files[0] }) }; handleSubmit = (e) => { e.preventDefault(); console.log(this.state); let form_data = new FormData(); form_data.append('floor_no',this.state.floor_no); form_data.append('distance',this.state.distance); form_data.append('area',this.state.area); form_data.append('no_of_rooms',this.state.no_of_rooms); form_data.append('price',this.state.price); form_data.append('images',this.state.images,this.state.images.name); let url = 'http://localhost:8000/'; axios.post(url, form_data, { headers: { 'content-type': 'multipart/form-data' } }) .then(res => { console.log(res.data); }) .catch(err => console.log(err)) }; django rest framework all null values are being posted(from initial state) instead of the ones entered from the form. { "floor_no": null, "distance": null, "area": null, "no_of_rooms": null, "price": null, "images": null } -
Filter Django query by week of month?
In a Django query, how would you filter by a timestamp's week within a month? There's a built-in week accessor, but that refers to week-of-the-year, e.g. 1-52. As far as I can tell, there's no other built-in option. The only way I see to do this is to calculate the start and end date range for the week, and then filter on that using the conventional means. So I'm using a function like: def week_of_month_date(year, month, week): """ Returns the date of the first day in the week of the given date's month, where Monday is the first day of the week. e.g. week_of_month_date(year=2022, month=8, week=2) -> date(2022, 8, 7) """ assert 1 <= week <= 5 assert 1 <= month <= 12 for i in range(1, 32): dt = date(year, month, i) _week = week_of_month(dt) if _week == week: return dt and then to calculate for, say, the 3rd week of July, 2022, I'd do: start_date = week_of_month_date(2022, 7, 3) end_date = week_of_month_date(2022, 7, 3) + timedelta(days=7) qs = MyModel.objects.filter(created__gte=start_date, created__lte=end_date) Is there an easier or more efficient way to do this with the Django ORM or SQL? -
use db constraints to limit a foreign key to have only one boolean value false while others true
i am having a model below class MaintenancePersonnel(models.Model): performed_by=models.ForeignKey(User,on_delete=models.CASCADE) work_performed=models.ForeignKey(EquipmentMaintenanceSchedule,on_delete=models.CASCADE) comments=models.TextField(blank=True,null=True) is_performed=models.BooleanField(default=False) I want for a given work performed to have only one field that has is_performed False i have tried using condition but this seems to force only one model to have is_performed equal to false regardless of the work performed class Meta: constraints = [ models.UniqueConstraint(fields=['work_performed','is_performed'], condition=models.Q(is_performed=False), name='unique_is_performed_False') ] -
Use managers in Factory-Boy for models
Use Factory-boy for retrieve operation without use the DB for testing case. I have this simple model: class Student(models.Model): name = models.CharField(max_length=20) ` To get all: Student.objects.all() With Factory-boy: class StudentFactory(factory.django.DjangoModelFactory): class Meta: model = Student Is there a way to make StudentFactory.objects.all() ? When I call the method all() in my factory, I would like to return a list of QuerySet created by me. Example: [QuerySet_1, QuerySet_2] # Not Database. With that, I can change my data from DB to memory in my test. -
Django STL Viewer?
It is possible to use django build web 3D viewer? The idea is upload a stl and view on the bowser, and able to zoom pan rotate on the bowser. Please correct me Django is a backend we have develop this think on frontend correct? what should I use for that? -
Django: Efficiently updating many to many relation
Let's say we have a Django User with a lot of Groups. We want to update the groups with a new list of groups. A simple but not performant solution could be: def update_users_groups(new_groups: List[Group]): user.groups.clear() user.groups.set(new_groups) A little bit more performant solution is something similar to: def update_users_groups(new_groups: List[Group]): new_groups = set([x.id for x in new_groups]) old_groups = set([x.id for x in user.groups.all()]) groups_to_add = new_groups - old_groups if groups_to_add: user.groups.add(*groups_to_add) groups_to_remove = old_groups - new_groups if groups_to_remove: user.groups.remove(*groups_to_remove) I could not find any hints in the documentation for a built-in method. Is there some best practice or any way I could improve my example from above? Maybe even s.o. has an idea for a more performant solution. Thank you in advance! -
Django not installed vcvarsall.bat
Whenever i try installing django with pip it says Microsoft visual c++ required (unable to find vcvarsall. Bat) I added vs build tools in path but still nothing