Latest Questions tagged Django

Browse all latest questions tagged Django

66
Votes
Published 31 Aug, 2022
Python - Django Test Run Environment error: no enough space left on disk

I was going through a Django tutorial, I was able to execute through the following steps creating a project, database setup the problem raised in development server step. I tried (venv)$ python manag...

26
Votes
Published 29 Aug, 2022
Python - How to realize a dynamic sidebar with Django?

I plan on creating a sidebar with changing elements (depending on the current url and authentication-status). For example: The default sidebar shows a login and a tag cloud. If a user is already lo...

3
Votes
Published 24 Apr, 2022
Javascript - How to pass a queryset from django to javascript function?

I want to pass a queryset from a view to a javascript function throught the template: my view.py: def myview(request): lista=Mymodel.objects.filter(tipo=mytipo) context_dict['lista']=lis...

34
Votes
Published 31 Aug, 2022
Python - How do I make django secrets available inside docker containers

My Environment docker 17.12-ce python 3.6.3 django 1.10.8 I have a django application that I want to containerise. Trying to maintain best practice I have followed the advice to split the settings...

14
Votes
Published 25 Aug, 2022
Python - Push rejected, failed to compile Python app

I'm getting a rejected error when trying to deploy a Django app to Heroku. I looked at possible solutions here: Heroku push rejected, failed to compile Python/django app (Python 2.7) Error pushing...

47
Votes
Published 29 Aug, 2022
Python - django-orm : How to update one-to-one relation field value

models.py class Area(models.Model): area_name = models.CharField(max_length=255, null=False, blank=False) description = models.TextField(null=False, blank=False) class AreaPoint(models.Model...

104
Votes
Published 26 Aug, 2022
Python - Django: How to limit number of objects returned from a model

I have a list of "news" headlines in a database with the following fields: ID, Title, Date. I want to get the ten latest ones (or retrieve all of them if there are less than ten). Something like: ne...

59
Votes
Published 01 Jul, 2022
Python - AUTH_USER_MODEL refers to model 'accounts.User' that has not been installed

I'm using a custom user model, extended with AbstractUser. Here's my models.py: # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.contrib.a...

36
Votes
Published 26 Apr, 2022
Python - How to use 'User' as foreign key in Django 1.5

I have made a custom profile model which looks like this: from django.db import models from django.contrib.auth.models import User class UserProfile(models.Model): user = models.ForeignKey('User...

1
Votes
Published 24 Apr, 2022
Python - Django PageNumberPagination customize error if page number out of range

I'm currently trying to create an API that return list of objects with page and limit per page input from url parameter using django-rest-framework which i already done in my api view with custom Pagi...

76
Votes
Published 23 Aug, 2022
Python - How do I install the yaml package for my PyCharm Python project?

I'm using PyCharm 2018.2.4 with Python 3.7. I want to run some seed data so in the Python management console, I tried running my yaml file, which ended in this error [email protected]_project >...

48
Votes
Published 23 Aug, 2022
Python - trouble with python manage.py migrate -> No module named psycopg2

I am having some trouble with migrating Django using postgresql. This is my first time with Django, and I am just following the tutorial. As suggested on the Django website, I have created a virtual...

32
Votes
Published 08 May, 2022
Python - Django - Display ImageField

I've just started to use Django and I haven't found a lot of info on how to display an imageField, so I made this: models.py: class Car(models.Model): name = models.CharField(max_length=255) p...

75
Votes
Published 17 Jun, 2022
Reactjs - TypeError: Cannot read properties of undefined (reading 'params') when fetching Data using async / await syntax

I am trying to access specific data from my django backend based on using the unique id in the url for my react app on the frontend. I expect to see the body of the journal Instead i get this error: T...

79
Votes
Published 26 Aug, 2022
Python - Change model field value after button click

I do really know that is a common topic but I've already checked every solution i could find and it did not work for me. I would like to add user points using button click. views.py def add_points...