Category "django"

How to upload a file and show progress bar in Django?

I have written code to upload a file in Django as follows: def upload(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FI

How do I use Django piston to return a response in text/plain?

I want to NOT serialize anything. I just want to return what is equivalent to HttpResponse(blah)

why i am getting this kind of error Validation Error?

ERROR: raise exceptions.ValidationError( django.core.exceptions.ValidationError: ['“” value has an invalid format. It must be in YYYY-MM-DD HH:MM[:s

Django Authenticate returns None

I have the following code snippet: user = User(username='[email protected]',email='[email protected]') user.set_password('pass') user.save() u = authenticate(username='[email protected]', p

How to setup Openwisp-radius with Django

I am trying to get started with openwisp-radius with django project. after setting up my django project with openwisp radius when i run py manage.py migrate i r

ImportError: Couldn't import Django ... Did you forget to activate a virtual environment?

I know there are several questions/answers about this, but I can;t figure out what I should do. I wanted to get started with Django and installed it with pip i

ConnectionRefusedError at /password-reset/ [WinError 10061] No connection could be made because the target machine actively refused it

When user enter email for password reset then error arise connection failure which is related to server failure error .

how to serve static files through nginx and django in windows

I am a newbie. Just got setup the apache server in windows. But now I need nginx to serve my static files and I think I have searched almost everywhere how to c

Backend docker image does not wait until db becomes available

I am trying to docker-compose up my containers, one for backend and another one for the database (postgis). If I docker-compose up db, I see db_1 | 2021-11-23

URLError: urlopen error timed out

Whenever i try to make a HTTP request to some url through my django application which is running on top of apache mod_python (Machine: Ubuntu 10.04 server editi

Django 'pip install django-heroku'(psycopg2) error is blocking deployment to Heroku

I am setting up a new Django project to deploy on Heroku, however when I am following the Django Heroku deployment guide I come across an error during 'pip inst

Django - multi-level table challenge

I'm new to Django, but an older programmer ;o) I've managed to create a functionally working site that has 5 tables. Where each one is a 1-to-M relationship to

'User' object has no attribute 'get'

I am trying to construct a ModelForm from this solution here, however i am getting this error: 'User' object has no attribute 'get' The idea is to get ModelF

Cannot login a normal user in a django website having a custom user model

I have made a Custom user model for my website. I have used AbstractBaseUser to make the model and also set it up at the settings. The creation of user and supe

How to test authenticated POST request with Pytest in Django

I want to test an authenticated post request on an API using Pytest. This is what I am doing so far: def test_auth_user_can_create(self, client):

Django CSRF Cookie Not Set

I have some problem for a while now, I'm experiencing CSRF Cookie not set. Please look at the codes below Python def deposit(request, account_num): if reque

{% load static %} Shown as a text line in html opened on browser

Im trying to use templatetags, but when i write {% load static %} on top of html document and run, it takes this as a text, and does not load the static. I set

PyCharm doesn't autocomplete Django model queries anymore in 2016.1.2

The 2016.1.2 version of PyCharm doesn't seem to autocomplete queries on Django models anymore. For example on Foo.objects.filter(some-field-lookup) the filter m

django.core.exceptions.ValidationError: ['“” value must be a decimal number.']

I got this error while migrating here is my models.py file: from django.db import models from django.conf import settings from decimal import Decimal # Create y

ValueError The QuerySet value for an exact lookup must be limited to one result using slicing on django views

am Getting this error i cant figure a way to solve it here are the views.py class SellerTransactionListView(ListView): model = Transaction template_na