Category "django"

'ProgrammingError: function avg(character varying) does not exist' - Django project

I have recently deployed a Django project to Heroku. While testing out the functionality in the browser, I've come across a new error when attempting to render

Rendering a string in django template as json object

I have a angular app that sends json data to a django backend. The django app save the json data in to a DB and later pulls it out to send it back to the angula

Check if user has a permission with specific codename in django

I am trying to check if a user has a permission, which I have defined in the class Meta of the model, with a specific codename. At the moment I have: if reques

How to add username to the filefield?

I am making use of file fields in my model and I want it to be saved as username_field.jpeg (or whatever format it is in), for example for rent_agreement I want

How to POST multiple objects in one JSON request?

I am using django-rest-framework and recently I encountered a problem. I need to post such request and get 2 objects created: { "lease": 28, "date": [

Django async testing: Cannot operate on a closed database

I was following this tutorial on testdriven.io in order to test some async functions in django and I need to add som decorators in order to enable my async test

django 'str' object has no attribute '_meta'

Sorry for my English. I have some data from another server, but I need to output this data like JSON. if i print response in console: { 'responseStatus': {

Mongoengine raw find_and_modify query gives "Must either update or remove" exception

I am using Django + mongoengine I want to update the books (embedded document) count in my Bookscollection document. I want the update query to return the full

How can I use a third-party API which has basic authentication (username, password) in Django?

I have one third-party API (a URL). To access that URL I have to give basic authentication which is username and password. How can I get data from that API usin

AssertionError at /graphql/ Query fields must be a mapping (dict / OrderedDict) with field names as keys or a function which returns such a mapping

I am new to django and graphql, I am trying use graphql in django using the the instructions given in this site. https://docs.graphene-python.org/projects/djan

Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?'

I am using windows 10 command line for a django project using python34 however, I am facing difficulties with SQL. I have already installed mysqlclient using

How to check if celery task is already running before running it again with beat?

I have a periodic task scheduled to run every 10 minutes. Sometimes this task completes in 2-3 minutes, sometimes it takes 20 minutes. Is there any way using

bootstrap datepicker not working in django

i am trying to integrate bootstrap datepicker but its not working setting.py: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contri

Django Allauth migration error

I've run across this issue before and I think I had to go into the library installed by pip to manually delete the migrations to fix it. Does anyone have a bet

Django Allauth migration error

I've run across this issue before and I think I had to go into the library installed by pip to manually delete the migrations to fix it. Does anyone have a bet

Django HTML form: how can I only populate a field value if it exists?

My Django application has a Person model with some optional text fields, such as: nickname = models.CharField(max_length=20, null=True, blank=True, default='')

Django testing rest-framework: APIRequestFactory vs APIClient

Being new to testing i'm looking to test my API in Django (Django-rest-framework). I'm setting up tests for my views, that is my API endpoints. Now looking ov

vuejs 401 unauthorized with axios from django backend with token

im trying to fetch data from django rest backend with axios in vuejs frontend but each time i get this error. the tokens match but it is still not authorizing.

Problem with redirecting in a Django HTML file

I am building a personal website and I am getting an error whenever I click on the the redirect link and I am quite puzzled how to proceed. I am also including

Separate Datetime field to show Date and Time separate in HTML using Django

I am using Python 3.6 and Django as web framework I have to save datetime together in my database but show date and time separate field in HTML. Model Code: cl