Category "django"

change datetime format using tempus_dominus DateTimePicker

I installed and imported DateTimePicker and used it as a widget to a Django DateTime Field When clicking on the field it shows me the date and time in format 07

I am making POST request from flutter app to Django-Rest user and getting null response

I'm a novice at this. I have been making POST requests from my flutter app to Django-Rest user and getting a null response on vendor name as copy pasted below.

django endpoint not returning all fields specified in serializer

This is Source Def: class SourceDefinition(models.Model): source = models.ForeignKey(Source, on_delete=models.DO_NOTHING) special_id = models.IntegerFie

Override Django cache settings in tests

I'm using Django DummyCache in my tests, however, there are a few tests which relay on real caching so using fake caching is not good here. Is there a clean w

NameError: name '_mysql' is not defined after setting change to mysql

I have a running Django blog with sqlite3 db at my local machine. What I want is to convert sqlite3 db to mysql db change Django settings.py file to serve MySQL

Getting email from LoggedIn user with Github

I have successfully setup Django with Django-allauth to register with Github but even if inside the scope on settings and asking for , it does not store the use

How to write setup.py to include a Git repository as a dependency

I am trying to write setup.py for my package. My package needs to specify a dependency on another Git repository. This is what I have so far: from setuptools im

How can I get my image to display using django?

I cannot get my images to display on my webpage while using Django. All I see is the images 'alt' text displayed, and a broken image icon next to it. I'm able t

The request's session was deleted before the request completed. The user may have logged out in a concurrent request, for example

I have a Python/Django app which sometimes has more than 100 users logged in. One day, I found this in Django error log: The request's session was deleted befo

(Django Allauth) 'CustomUser' object has no attribute 'username'

I'm trying to implement a CustomUser model in Django Allauth. When I used the allauth provided login template, I encountered this error My Customer User Model

Django: How to disable ordering in model

Let's say there is a model with default ordering described in Meta class class People(models.Model): first_name = models.CharField(max_length=100) las

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used. Traceback (most recent call las

Django The 'image' attribute has no file associated with it

When a user registers for my app.I receive this error when he reaches the profile page. The 'image' attribute has no file associated with it. Exception Type: V

Django: How can I check the last activity time of user if user didn't log out?

django's User model has a last_login field, which is great if all the users were to log out each time they leave the site, but what if they don't? How can I tr

Saving a zipfile into directory using django

I am trying to save the zip file into one directory on my server. First, I am uploading a zip file using form and in python, I want to save it in one directory

Django: Keeping setUpTestData DRY

I've been really enjoying the convenience of setUpTestData and --keepdb in Django 1.8! However, I am running into an issue keeping data consistent across multi

How to stop gunicorn properly

I'm starting gunicorn with the Django command python manage.py run_gunicorn. How can I stop gunicorn properly? Note: I have a semi-automated server deployment

how to compare only date from a model's datetimefield with current date?

I want to use Model.objects.filter(datetime_lte=datetime.datetime.now.date()) How exactly can I achieve this? I am using django 1.6.5. I want only records of cu

django test app error - Got an error creating the test database: permission denied to create database

When I try to test any app with command (I noticed it when I tried to deploy myproject using fabric, which uses this command): python manage.py test appname

fakeredis between multiple django views

I have a test which involve multiple Django views It seems that the fakeredis isn't shared between multiple views I tried running the following code: import f