Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Not allowed to load local resource error when trying to add custom CSS stylesheet to HTML document
I am writing a project with Django, Bootstrap, HTML and CSS. The code I found provided a bootstrap stylesheet. When I run the program on developer server 127.0.0.1:8000 the bootstrap styles are applied. I am trying to add a stylesheet to my HTML file with custom styles. I am receiving a "Not allowed to load local resource: file:///C:/Users/Keith/OneDrive/DjangoProjects/django_forms/myapp/templates/formstyles.css" in the Chrome console when I try to run the project. form.html \\ {% load crispy_forms_tags %} <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"> <!-- <link rel="stylesheet" href="C:/Users/Keith/OneDrive/DjangoProjects/bootstrap-5.0.2-dist/bootstrap-5.0.2-dist/css/bootstrap.min.css"> --> <link rel="stylesheet" type="text/css" href="C:\Users\Keith\OneDrive\DjangoProjects\django_forms\myapp\templates\formstyles.css"> </head> <body style="padding: 20px;"> {% crispy form form.helper %} </body> </html> \\ Custom CSS style sheet formstyles.css \\ input { `color: #683aa4 !important; `margin-top: 100px !important; `} \\ the HTML file and CSS file are in the same directory thank you, -
python script load file via post on django
I'm testing this script to load a document to a webpage in django The GET and POST request return 200 but the file is not loaded. If the answers are 200 why don't load the file I'm doing wrong? code: import requests url='http://localhost:8000/' files = {"docfile": open('test.txt', "rb")} s = requests.Session() resp1 = s.get(url) print(resp1.text) csrf_token = resp1.cookies['csrftoken'] resp2 = s.post(url, data={'csrfmiddlewaretoken': csrf_token,"file":files}) print(resp2.text) resp POST: This is the message from the POST request. <ul class="errorlist"><li>This field is required.</li></ul> -
Can't change font-family in main.css
Currently using Django with bootstrap 4. For whatever reason, I cannot get the font-family to change through my main.css file. I can change other attributes, but font does not seem to work. If I change the font-family in my other files, it works. I just cannot change it through my main.css. What am I doing wrong? base.html {% load static %} <!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <link rel="stylesheet" href="{% static 'css/main.css' %}"> ... main.css body { font-family: "Times New Roman", Georgia, serif !important; } -
Django: Find which object a BaseManager or QuerySet comes from
I'm passing BaseManager and QuerySet to a function to perform exclude statements. Can I find out which class the BaseManager comes from? This is to properly give keyword arguments to exclude. The current method only works when called on something from Fragment. class Sampler: @staticmethod def exclude_one(query: BaseManager, element: Union[Fragment, Model]): if isinstance(element, Fragment): return query.exclude(kind=element.kind, number=element.number) elif isinstance(element, Model): return query.exclude(model__name=element.name) Here is models.py. class Fragment(models.Model): kind = models.CharField(max_length=50) number = models.IntegerField(blank=True, null=True) model = models.ForeignKey('Model', models.DO_NOTHING, db_column='model', blank=True, null=True) unique_id = models.AutoField(primary_key=True, blank=True, null=False, default=0) def __str__(self): return f"{self.model}_{self.kind}{self.number}" class Model(models.Model): name = models.CharField(primary_key=True, blank=True, null=False, max_length=50) classes = models.IntegerField(blank=True, null=True) relations = models.IntegerField(blank=True, null=True) def __str__(self): return self.name -
deploy django + channels to heroku
I'm using python 3.9.1 , django 3.2.5 , redis 5.0.7 and channels 3.0.4 this is my first time using channels so forgive me if this was an easy question for you I'm building a chat app so my app is running locally with no problems at all (windows 10 and wsl 2 with ubuntu 20.04 ) trying to upload to heroku gives me app crached for multiple different reasons after each doc I read and tutorial I tried to follow this is my procfile release: python3 manage.py migrate web: daphne online_chat.asgi:application --port $PORT --bind 0.0.0.0 -v2 worker: python3 manage.py runworker channel_layer --settings=online_chat.settings -v2 asgi.py import os import django from channels.routing import ProtocolTypeRouter, URLRouter, get_default_application from channels.auth import AuthMiddlewareStack from django.core.asgi import get_asgi_application from main.routing import websocket_urlpatterns from .wsgi import * os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'online_chat.settings') django.setup() django_asgi_app = get_asgi_application() application = ProtocolTypeRouter({ "http": django_asgi_app, "websocket": AuthMiddlewareStack( URLRouter(websocket_urlpatterns) ) }) also tried different mixes between # application = get_default_application() django_asgi_app = get_asgi_application() # ASGI_APPLICATION = get_asgi_application() setting.py WSGI_APPLICATION = 'online_chat.wsgi.application' ASGI_APPLICATION = 'online_chat.asgi.application' REDIS_URL = os.environ.get('REDIS_URL', ('127.0.0.1', 6379)) CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', 'CONFIG': { "hosts": [REDIS_URL], } }, } also tried to use asgi_redis but this caused more problems as it … -
TypeError: orderTimelocation() got an unexpected keyword argument 'order'
I have the models order and orderTimelocation. Order has a one to many relationship with orderTimelocation: class Order(models.Model): customer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='customer') retailer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='retailer') date_publish = models.DateField() date_available = models.DateField() weight = models.DecimalField(decimal_places=2, max_digits=5) class orderTimelocation(models.Model): order = models.ForeignKey(Order, on_delete=models.CASCADE, related_name='ordertimelocation'), longitude = models.DecimalField(decimal_places=8, max_digits=12) latitude = models.DecimalField(decimal_places=8, max_digits=12) And trying to serialize the order model, that should receive ordertimelocation's. For that I'm using Writable nested serializers, as described on DRF documentation class OrderSerializer(serializers.ModelSerializer): ordertimelocation = orderTimelocationSerializer(many=True) class Meta: model = Order fields = ['customer', 'retailer', 'date_publish', 'date_available', 'weight', 'ordertimelocation'] def create(self, validated_data): timelocations_data = validated_data.pop('ordertimelocation') order = Order.objects.create(**validated_data) for timelocation_data in timelocations_data: orderTimelocation.objects.create(order=order, **timelocation_data) return order I think my code is similar to the one on the documentation but the following erro happens: Traceback (most recent call last): File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view return view_func(*args, **kwargs) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view return self.dispatch(request, *args, **kwargs) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/home/miguel/workspace/projeto-final/backend/env/lib/python3.8/site-packages/rest_framework/views.py", line 506, … -
Is there a faster way to use django-taggit?
I am attempting to use django-taggit to tag client images. I didn't notice the problem at first, but things have started to slow way down, now that there are more images to load. Is there a better way to handle this so that it isn't making as many calls to the db? TIA manage_images.html {% for tag in image.tags.all|dictsort:"name" %} <label class="label label-purple" style="font-size: 14px;">{{ tag }}</label> {% endfor %} models.py class Image(models.Model): client = models.ForeignKey(Client, on_delete=models.CASCADE, null=True) image = models.ImageField(null=True, blank=True, upload_to=get_image_upload_path) thumbnail = models.ImageField(null=True, blank=True, upload_to=get_thumbnail_upload_path) filename = models.CharField(max_length=100, null=True, blank=True) width = models.IntegerField(null=True, blank=True) height = models.IntegerField(null=True, blank=True) size = models.IntegerField(null=True, blank=True) active = models.BooleanField(default=0) tags = TaggableManager() created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now_add=False, auto_now=True) -
Django Translate Templates String Filter
I have read the documentation and a created a tag <div>{{ site_name|default:_("It works!") }}</div>. In order to translate the "It works!" string, I just configured the django.po file as shown bellow and the translation was successful: msgid "It works!" msgstr "Funciona!" However, trying to translate the "No" string in the index.html, I configured the django.po file as shown bellow and I got no translation: msgid "No" msgstr "Sem" Would anyone point me if I missing any configuration for translating the "No" string in the index.html file. -
Trying to Deploy Django App Through Elastic Beanstalk, Module not found error
I'm trying to deploy a Django application AWS Elastic Beanstalk. I followed this guide: https://medium.com/@justaboutcloud/how-to-deploy-a-django3-application-on-elastic-beanstalk-python3-7-and-amazon-linux-2-bd9b8447b55 but when I attempt to deploy I have a 502 error when I go to the site page, and when I look through the logs the error I have is ModuleNotFoundError: No module named 'django3.wsgi' My code is stored like this: django3 |--- manage.py |--- requirements.txt |--- .ebextensions |--- 01_python.config |--- django3 |--- __init__.py |--- asgi.py |--- settings.py |--- urls.py |--- wsgi.py And my 01_python.config file has: option_settings: "aws:elasticbeanstalk:application:environment": DJANGO_SETTINGS_MODULE: "django3.settings" "PYTHONPATH": "/var/app/current:$PYTHONPATH" "aws:elasticbeanstalk:container:python": WSGIPath: django3.wsgi:application NumProcesses: 3 NumThreads: 20 My requirements.txt file is asgiref==3.4.1 Django==3.2.5 gunicorn==20.1.0 pytz==2021.1 sqlparse==0.4.1 I'm not sure what I have that is wrong, if someone could help me out that would be great. I've tried messing around with the formatting of the 01_python.config file but nothing is helping fix the issue. -
Assigning a Class for a label in the Django forms
I am trying to add a class for label in a custom django form. I am able to add class to the input but for the labels I have been struggling for a while: Here is the form: class infoForm(ModelForm): class Meta: model = Info fields = ['businessName'] widgets={ 'businessName':forms.TextInput(attrs={"class": 'form-control'}), } labels = { 'businessName': 'Business Name', } Here is the model class Info(models.Model): businessName = models.CharField(max_length=100) My question: How to add the class form-label inside the label of every input? Thank you -
raise validation error if there is two president for the same club?
in my model, I don't want two presidents for the same club. I have 6 clubs so I will have 6 presidents too no more. I'm new to validation I tried to use the clean method but the error won't get raised. my model: class MyUser(AbstractUser): STUDENT = 1 INSTRUCTOR = 2 ADMIN = 3 ROLE_CHOICES = ( (STUDENT, 'student'), (INSTRUCTOR, 'instructor'), (ADMIN, 'admin'), ) club_name = ( (0, 'ISOM'), (1, 'Accounting'), (2, 'PA'), (3, 'Finance'), (4, 'Management & Marketing'), (5, 'Economics'), ) is_president = models.BooleanField(default=False) club_name = models.IntegerField(choices=club_name, default=0, verbose_name='Club/Department') roles = models.PositiveSmallIntegerField(choices=ROLE_CHOICES) the validation I used: def clean(self): club = MyUser.objects.all() president = MyUser.objects.all() try: club.objects.get(club_name__iexact=club_name) president.objects.get(is_president__iexact=is_president) except club.DoesNotExist: return club_name, is_president raise ValidationError(_("A president for this club already existed.")) -
How do fix OperationalError: no such column: "something" in django?
I have a model in models.py called location with a field named "something" and whenever I use the manage.py migrate command after the makemigrations command I get the "django.db.utils.OperationalError: no such column: "something"" error. I've seen other people ask questions like this but none of the answers help me, can someone heko me out -
Running into Redis Connection error when adding a second queue to django-RQ
This issue is most likely because of my misunderstanding of how django-RQ/redis works. I've been using django-rq with great results to run/cache long running processes. However, we're now in a position where we need to split up some of these processes into different queues. The docs make this seem easy enough. However, I get the following error when trying to send a task to the pro queue: Could not resolve a Redis connection I was thinking it was possibly because I'm using the same connection info for both queues, but I've seen other examples that do the same thing (https://newbedev.com/how-to-create-multiple-workers-in-python-rq). Where did I go wrong? (I included the local and heroku settings as the same issue exists in both). if(on_heroku): RQ_QUEUES = { 'default': { 'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku 'DEFAULT_TIMEOUT': 500, }, 'pro': { 'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku 'DEFAULT_TIMEOUT': 500, } } else: RQ_QUEUES = { 'default': { 'HOST': 'localhost', 'PORT': 6379, 'DB': 0, 'DEFAULT_TIMEOUT': 500, }, 'pro': { 'HOST': 'localhost', 'PORT': 6379, 'DB': 0, 'DEFAULT_TIMEOUT': 500, } } -
Listen to mqtt topics with django channels and celery
I would like a way to integrate django with mqtt and for that the first thing that came in my mind was using django-channels and an mqtt broker that supports mqtt over web sockets, so I could communicate directly between the broker and django-channels. However, I did not found a way to start a websocket client from django, and acording to this link it's not possible. Since I'm also starting to study task queues I wonder if it would be a good practice to start an mqtt client using paho-mqtt and then run that in a separate process using celery. This process would then forward the messages receives by the broker to django channels through websockets, this way I could also communicate with the client process, to publish data or stop the mqtt client when needed, and all that directly from django. I'm a little skeptical about this idea since I also read that process run in celery should not take too long to complete, and in this case that's exactly what I want to do. So my question is, how much of a bad idea that is? Is there any other option to directly integrate django with mqtt? *Note: … -
Add a download functionality in django change view
I already added a button alongside the save buttons for my django change view: {% extends 'admin/change_form.html' %} {% load static %} {% load i18n %} {% block submit_buttons_bottom %} <div class="submit-row"> <input type="submit" value="Download" id="download_profile" name="_continue"> <input type="submit" value="{% trans 'Save' %}" class="default" name="_save"> <input type="submit" value="{% trans 'Save and add another' %}" name="_addanother"> <input type="submit" value="{% trans 'Save and continue editing' %}" name="_continue"> <!-- inmport script --> <script src="{% static '/js/downloadData.js' %}"></script> <script src="{% static '/js/collapsibleSection.js' %}"></script> <script src="{% static '/js/investmentAdminScript.js' %}"></script> {% endblock %} and I already started adding the script to retrieve individual data per row to download them. 'use strict'; window.addEventListener('load', () => { const downloadButton = document.querySelector('#download_profile'); downloadButton.addEventListener('click', e => { if (!confirm('Data will be saved before downloading. Are you sure you want to continue?')) { e.preventDefault(); return; } // get module const fieldsets = document.querySelectorAll('fieldset'); fieldsets.forEach(thisFieldset => { const dataRows = thisFieldset.querySelectorAll('.form-row'); dataRows.forEach(dataRow => { // retrieve each input field and add a download to .xlsx function }); }); }); }); However, it gets complicated very fast. Is there a better way to do this? -
Django Rest Framework Serializing Custom Field
I am trying to serialize a custom field that is not on my model. The queryset code groups the model on the item1 field and generates a count column. There is no count field on my Data model. views.py class GetDataGroups(generics.ListAPIView): serializer_class = DataSerializer def get_queryset(self): queryset = ( Data.objects.values("item1") .annotate(count=Count("item1")) .order_by() ) return queryset serializers.py class DataSerializer(serializers.ModelSerializer): count = serializers.CharField(write_only=True) class Meta: model = Data fields = ["item1", "count"] How do I also get the count field to show up in my rest api? -
django restrict value to a foreign key of a foreign key
I have three models Address: Representing an address Itinerary: Representing a set of addresses. It has ManyToManyField relation with Address Appointment: Representing Address within the itinerary. It has a Foreign key to Itinerary and a Foreign Key to Address. What I am trying to understand is what's the best way to establish a relationship between Appointments and Itinerary/Address so that when selecting an address for an appointment, users can only chose among the addresses associated with the Itinerary to which the appointment is associated. Basically I am trying to limit the choices of the field app_location within the Appointment model to only have as selection-able options Address present in the location field of Itinerary model (associated with appointment) class Address(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) address1 = models.CharField("Address line 1", max_length=1024,) zip_code = models.CharField("ZIP / Postal code", max_length=12, blank=True, null=True) class Itinerary(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) title=models.CharField(max_length=40) location=models.ManyToManyField(Address, related_name='location') class Appointment(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) app_location=models.CharField(max_length=20) contact=models.ForeignKey(Contact, on_delete=models.CASCADE, blank=True, null=True) itinerary=models.ForeignKey(Itinerary, on_delete=models.CASCADE, blank=True, null=True) -
How to create two models with required ForeignKey fields to eachother?
I have two models, both of them with a ForeignKey field to eachother. from django.db import models class County(models.Model): capital = models.ForeignKey("Municipality", on_delete=models.PROTECT, related_name="capital_of") class Municipality(models.Model): county = models.ForeignKey(County, on_delete=models.CASCADE, related_name="municipalities") With these models, I'm unable to create nor an instance of County or Municipality. What should I do to fix it? -
Django + Dockerfile + Cron
I have been working on a task for a few days. Building a separate Dockerfile (not using docker-compose just a stand alone Dockerfile) that is supposed to produce an image and run a cron job which I have not done before. I believe I am almost there, but running into a config/settings issue when running the script. I have a short Dockerfile here... FROM python:3.7.8-alpine RUN apk update RUN apk add --no-cache libpq postgresql-contrib python3-dev RUN apk add --no-cache supervisor postgresql-dev RUN python3 -m pip install --upgrade pip ADD ./app/requirements.txt /files/requirements.txt ADD ./app/reqs/ /files/reqs/ RUN python3 -m pip install -r /files/requirements.txt RUN touch /var/log/cron.log ADD cronjobs/crontab.txt /crontab.txt ADD cronjobs/cron_script.sh /cron_script.sh ADD ./script.py /script.py COPY cronjobs/entry.sh /entry.sh ADD ./script.py /app COPY ./script.py /app RUN chmod +x /script.py RUN chmod 755 /script.sh /entry.sh RUN /usr/bin/crontab /crontab.txt COPY . /cron_app CMD ["/entry.sh"] crontab.txt file here.. * * * * * /cron_script.sh > /dev/stdout entry.sh file here. #!/bin/sh echo "Docker container running....." /usr/sbin/crond -f -l 8 Script which calls the main python script. #!/bin/sh echo "Python script running..." cd /cron_app python3 send_email.py echo "python script has finished..." The script sends an email, which uses django's settings, and email config in my settings file which … -
Unable to create using .object.create() in DJANGO 3.5+
I am having trouble creating objects using '.objects.create()' in Django v3.5+ here is my create function - order = Order.objects.create( txn_id = txn_id, user = request.user, payment_id = pay_id, gateway_order_id = str(gateway_order_id), gateway_signature = str(signature), amount = basket.get_total_price(), payment_option = "Wallet", order_status = True,) Here are they values captured and trying to populate - 9 teddy pay_HbkHTcQsUzT0Rb order_HbkH3jmcvfhQR8 53fa5704b595832d472ccc08e193d2b686078d78ca7fa7e403f763c753568433 90.00 Wallet True and here is the corresponding model class Order(models.Model): txn_id = models.ForeignKey(Transaction, on_delete=models.CASCADE, related_name="order_txn") user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="order_user") payment_id = models.CharField(max_length=100, null=True, blank=True) gateway_order_id = models.CharField(max_length=100, null=True, blank=True) gateway_signature = models.CharField(max_length=100, null=True, blank=True) amount = models.DecimalField(max_digits=5, decimal_places=2) payment_option = models.CharField(max_length=200, blank=True) order_status = models.BooleanField(default=False) created = models.DateTimeField(auto_now_add=True) class Meta: ordering = ("-created",) def __str__(self): return str(self.created) any assitance would be appreciated. Many Thanks in Advance! -
Django OAuth Toolkit refresh token using okta workflow API Connector
I have successfully created an oauth provider and can verify that I am able to get a token and refresh token using django-oauth-toolkit. While using [okta workflow api connector][1] OAUTH option, it is able to get the token after going through the initial setup. However, once that initial token expires, it is not getting a refreshed token as expected. The scope that the connector is setup with is an additional scope that I added to the settings.py of my django project via the SCOPES setting similar to how the doc's show in [this link][2]. As I am new to django-oauth-toolkit. My first question is does a new scope added via this method need to have additional configuration in order to allow an oauth2 connection to get a refresh token? I am using django-oauth-toolkit 1.5.0 [1]: https://help.okta.com/wf/en-us/Content/Topics/Workflows/function-reference/HTTP/http_authorization.htm [2]: https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/getting_started.html -
Applying and managing Django migrations in Skaffold development environment
I'm not satisfied with my current workflow related to managing Django migrations and it really feels like there should be a better way. As part of my environment setup shell script, it creates a .venv and adds env vars to it for DB connection strings and the such. When I work on models and need to migrate this gives me the ability to run ./manage.py migrate in the local environment to apply them. This is really the only purpose it serves. It also adds the same env vars to Kubernetes secrets for the cluster. I came across this where someone had a similar issue, but was kubectl exec into the Pod: How to keep Django 2.2 migrations on Kubernets while developing? That would mitigate the need to run ./manage.py locally and thus have the env vars, but kubectl exec into the Pod just to run ./manage.py migrate seems like an even bigger hassle. It seems like there should be a better way. Suggestions? -
Django Rest Framework URL filter only specific fields from Database
I did try to search my problem in StockOverflow or Google, but I can find only how to make Search results and how to make search on specific fields, but I need API output with specific fields with URL request. I have DB with those fields: date = models.DateField(['%Y-%m-%d']) channel = models.CharField(max_length=255) country = models.CharField(max_length=255) os = models.CharField(max_length=255) impressions = models.IntegerField() clicks = models.IntegerField() installs = models.IntegerField() spend = models.FloatField() revenue = models.FloatField() I did create different filters which can be used to GroupBy, ordering and another good features. The problem is: for example I have task to: Show the number of impressions and clicks that occurred before the 1st of June 2017, broken down by channel and country, sorted by clicks in descending order. If I use this: http://127.0.0.1:8000/api/stock?date_to=2017-05-19&groupby=channel&groupby=country&ordering=-clicks It will give me this result: "results": [ { "channel": "adcolony", "country": "US", "impressions": 101292, "clicks": 2479, "installs": 445, "spend": 743.6999999999999, "revenue": 965.12, "CPI": "1.67" }, It was Grouped by "channel" and "country" for specific date in DESC order. But how to make additional URL inputs (like show only "impressions" and "clicks")to show ONLY those: "results": [ { "channel": "adcolony", "country": "US", "impressions": 101292, "clicks": 2479, }, This is my … -
sudo apt install python3-dev for windows
I'm trying django-oscars demo and I'm wanted to test it out but I'm literally stuck on the first part lol. I need help since I can't use sudo for windows what should I do then? "sudo apt install python3-dev" djang-oscar -
KeyError at /home 'assets', using webpack loader
I'm working on a small project using Django and VueJS, i just install django-webpack-loader and "webpack-bundle-tracker": "^0.4.3", and i got an error while rendreding : KeyError at /home 'assets' This is my code : {% load render_bundle from webpack_loader %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hello</title> </head> <body class="sidebar-enable vertical-collpsed"> <!--<h1>Vue JS</h1>--> <div id="app"></div> {% render_bundle 'app' %} </body> </html>