I use social-auth-app-django for my django website. Login all works, but after the token expires. I cant access the google’s user data anymore. I found how to refresh the token, but it gives Here is some of my code in my settings file: Answer Fixed it by adding this: If the user already registered, you need to force the prompt
Tag: django
Django user registration form not showing properly
I am making a Django project where there are two types of users customer and restaurant. Both can register separately. Everything is running fine except that I cannot add CSS class to password field and there are warning showing around password field which I don’t how they are coming. Models.py Forms.py soryy for bad code pasting.Just for clarification class ‘CustomerSignupform’
How to stop autopep8 not installed messages in Code
I’m a new Python programmer using the Mac version of VS Code 1.45.1 to create a Django project. I have the Python and Django extensions installed. Every time I save a Django file, Code pops up this window: I keep clicking the “Yes” button to install the autopep8 extension but this message keeps popping up nevertheless. Is there some trick
Sort a QuerySet by ManyToManyField in Django
I have a model like this: I want to get all Objects of my_model sorted by the number of objects in the foo field. In this Question A friendly Guy from russia says, that you should use django-annontation. I tried the following: and it works fine. Is there any reason I should go the longer way with annotations?? Thx for
JSONField in Django continues to remain empty even after POST request
I have a model with a JSONField in Django. If I issue POST through the browser using Django Rest UI, the data gets entered into the model with no issues. However,when I use Python’s requests.post in my application, everything except the JSONField data stores in the model. Here is my model Here is my Serializer Here is my view Here
Django request.FILES gets name, filename but not file (blob)
I’m trying to send an audiofile via a POST request to the server (aws, ec2) and I’m using Django, but my request.FILES doesn’t receive the blob file, but it DOES receive the key and the filename. Everything worked fine when I ran this on localhost. How can I get the file? I’m enabling my website on chrome://flags/#unsafely-treat-insecure-origin-as-secure, so that I
How to use Django session variable in models.py
I wanna use the Django session variable on models.py file. How can I do it? I want to get the user’s Pincode/zip and have to run a query using that. I need to get Pincode from the session. Answer In your model method you don’t have access to the request so you do not have access to the session. One
Celery with Rabbit MQ Virtual Host not accepting tasks from app.tasks.py in Django
Help needed! PS: I have already created Virtual Hosts using this link Celery and Vhosts settings.py celery.py import os from celery import Celery from django.conf import settings app1.tasks.py Attaching images from my terminal, one of of the worker instance other is of the shell from which I am firing the tasks. Note: I started both after settings and all but
‘microsecond’ is an invalid keyword argument for replace()
I am using Django 2.0+ and am attempting to just plug in the existing password reset function into my website. If the email does not exist, it successfully submits. If it DOES exist, I get this error: ‘microsecond’ is an invalid keyword argument for replace() I never touched any of the backend code for this function so I would assume
IntegrityError NOT NULL constraint failed: – in validating form missing user id (foreing key of anothermodel)
Previous title: Unable to import ‘misaka’ – Django I am following a tutorial about how to build a social network. I run into this error: IntegrityError at /posts/new/ NOT NULL constraint failed: posts_post.user_id Complete traceback (please note the lines in bold): The lines in bold are pointing to these two pieces of code: 1: In my_projectpostsviews.py in form_valid: 2: In