Can I use the Node.js packages along with Django?

I think I haven't understood this concept right . If I am using Django as a backend to run server side code , is there a way to include the packages of Node.js also . Isn't Node.js kind of another environment or language for server side code ? If...
more »

2017-12-03 20:12 (2) Answers

Django Model Inheritance - get child

Is there a way to access the actual child of the base model, means: Staying with the example from the django Docs, let's assume I am modeling different delivery restaurants, that just have in common name all have a deliver method as of this: cla...
more »

2017-12-03 15:12 (1) Answers

How to show content by scrolling down?

I have written some html code for my webpage in which multiple images are shown. the problem is, all the images are loaded at the starting itself. I want to change that to show extra images by scrolling down. How to do that with jQuery? The code is:...
more »

2017-12-03 13:12 (3) Answers

Creating a .gitignore file for a Django website

I'm ready to push my existing Django project (which i've been running in a local environment) to a Bitbucket repository so I can run it on a public server. At the moment I feel like there's a lot of files created in local development that needs to be...
more »

2017-12-03 09:12 (2) Answers

python django: login with office 365

I am trying to implement a office365/azureAD/MS graph authentication system for a Django website. My University has a office365 account system for all students. If you log in using your ID for that you get access to all MS Office software and other ...
more »

2017-12-03 01:12 (1) Answers

Django create s3 bucket with button

I'm trying to create a button which will create an S3 bucket in AWS once clicked. I am still a bit green when it comes to Django so I'm not sure how to get this to run. I read a few tutorials but all of them show how to add something to a database wh...
more »

2017-12-02 17:12 (1) Answers

django too many values to unpack error

i have stored a list in django and now i want to convert that list to query set . ques=list(sorted(Upload.objects.filter(unique_id=tdetail), key=lambda x: random.random())) platform=Platform() platform.user=request.user platform.test_...
more »

2017-12-02 15:12 (0) Answers

Django image form isn't saving the image

I have a form that involves uploading a profile picture. I have it working so that I can upload images in the /admin/ interface and display them correctly, but I cannot get my Modelform to save the image. Here is what I have: models.py class Cand...
more »

2017-12-02 10:12 (1) Answers

How to translate docker-compose.yml to Dockerfile

I have an application written in Django and I am trying to run it in docker on Digital Ocean droplet. Currently I have two files. Can anybody advise how to get rid of docker-compose.yml file and integrate all the commands within Dockerfile ??? Dock...
more »

2017-12-02 10:12 (2) Answers

Django: Get all objects from a specific user

I have a problem when trying to display all the Announce objects from a user. My problem is : Consider that I am logged in as a user with an id=1. When I go to /users/1/ it displays all my posts. But the problem is when I want to display all the post...
more »

2017-12-01 17:12 (1) Answers

Making SSO with django rest framework

We have two apps App1 with domain www.app1.com and App2 with domain www.app2.com. Backend of both apps is api based using django-rest-framework. On frontend side we are using Angular2. Both apps had their different user base but now we decided to me...
more »

2017-12-01 11:12 (0) Answers

Requested setting DEFAULT_INDEX_TABLESPACE

I'm making a populate.py script to transfer data from a mysql database to a django mysqlite database. I keep getting this error when I run my populate.py script: Requested setting DEFAULT_INDEX_TABLESPACE, but settings are not configured. You ...
more »

2017-12-01 10:12 (0) Answers

Django Settings, Git and Amazon AWS

I'm using Django, Git and Amazon's Elastic Beanstalk. With my Django, I don't want to store my settings files on my git. The problem is now I can't use eb deploy since it copies my git code to my AWS without the settings file and then fails. How ...
more »

2017-12-01 04:12 (2) Answers

NameError in Django simple search

I have a simple search in my Django project. I want to search through documents using their type and part of factory info in addition to search by name. Here is my models.py: class Docs(models.Model): Date = models.DateField(default=date.today) ...
more »

2017-11-30 20:11 (2) Answers

JSON data not coming through from Django REST API

I have a Django REST API with an Angular Front-end. I am getting no errors on the front-end, but no json data is logging to the console. I have a service like so: import { Injectable } from '@angular/core'; import { Http, Response } from '@angular...
more »

2017-11-30 19:11 (1) Answers

Should Whitenoise auto-compress static files? How?

I recently enabled Whitenoise for my Django project that will run on Heroku. I want Whitenoise to compress my static files automatically, as would seem to be possible from this part of the docs: http://whitenoise.evans.io/en/stable/django.html#add-co...
more »

2017-11-30 18:11 (1) Answers

Printing to NamedTemporaryFile on Windows

The original Problem - MCVE The following script should use chrome headless, to print to pdf (I am running windows 10, and python 3.6): import subprocess from tempfile import NamedTemporaryFile output = NamedTemporaryFile() CHROME_PATH=r'"C:\Prog...
more »

2017-11-30 15:11 (2) Answers

Django save blank value

I have a number of unknown values in a df, where the cells are filled with the chars '---' I would like to tell Django that, if it finds something that is not a number of any kind (int / decimal / floating point) to leave the value of that field bla...
more »

2017-11-29 16:11 (1) Answers

Django get_or_create returns False

I'm creating a population script, from an MysqlDatabase to Django Models. Im looping through my receiving data from the Mysql and thats going good. Now I have to write it to the Django Database... mdl, succeeded = models.User.objects.get_or_create(...
more »

2017-11-29 10:11 (1) Answers

Create password protected zip file Python

I'm using following code to create password protected zip file, from a file uploaded by user, in my Python34 application using zipFile. But when I open the zip file from windows, it doesn't ask for the password. I will be using the same password to r...
more »

2017-11-29 08:11 (2) Answers

Vue Js: selectpicker(''refresh") not working

$('.selectpicker').selectpicker('refresh') This is done to initialize the selectpicker. When I run this is in console of chrome.. the dropdown list appears. So, in vuejs I added this code in mount(). But nothing is happening.. I have asked another...
more »

2017-11-29 05:11 (1) Answers

Filter Django queryset for a dict value

I have a queryset of Products with JSONField attributes containing dict class Product(models.Model): attributes = JSONField( pgettext_lazy('Product field', 'attributes'), encoder=DjangoJSONEncoder, default={}) I want to filter Products wh...
more »

2017-11-28 22:11 (1) Answers