Questions tagged [django-shell]
78 questions
1
vote
1 answer
Django context processor not rendering from shell
Using Django 3.2
Have defined few global variables like
app/context_processors.py
from app.settings import constants
def global_settings(request):
return {
'APP_NAME': constants.APP_NAME,
'APP_VERSION': constants.APP_VERSION,
…

Anuj TBE
- 9,198
- 27
- 136
- 285
1
vote
1 answer
How to cut and paste in bpython?
I would like to cut and paste directly in the shell session, if possible. I have a simple with block in a .py file:
with open('t1_equip.json') as json_file:
data = json.load(json_file)
# Print the type of data variable
print("Type:",…

roland garceau
- 71
- 3
1
vote
1 answer
django retrieving all objects from one to many model relationship in shell
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Board(models.Model):
title = models.CharField(max_length=50, null=True)
user = models.ForeignKey(User, null=True,…

icecube
- 111
- 2
- 16
1
vote
1 answer
How to print Django queryset in Tabular form in python3 manage.py shell
Is there a way or package to print Django queryset in Tabular form in python3 manage.py shell
The queryset prints like
But I want it to be printed like

Aaqib
- 367
- 3
- 14
1
vote
1 answer
Why is the QuerySet not updating after save in django shell?
So today , when i was learning Django shell interface for Database , i faced a very strange issue.
I couldn't get the updated the data even after doing the save method .
I searched about this issue, but in all those queries, they where missing save…

Sandrin Joy
- 1,120
- 10
- 28
1
vote
1 answer
starting Django shell but python interpreter kicks off
I started the Django's shell using:
python3 manage.py shell
but weirdly the python interpreter is kicking off instead (I see >>> instead of [n]:, and the initializing text contains no Django information, besides the main imports for the shell…

slimguat
- 45
- 5
1
vote
2 answers
Django update model in shell not saving
I´m trying to update the data of an existing model with a csv. I read the file and assign the values with no problem.
If I try `MyModel.update() everything runs with no error but the data is not saved.
with open('Productosold.csv') as csvfile:
…

Francisco Ghelfi
- 872
- 1
- 11
- 34
1
vote
1 answer
django shell not detecting new module
Hello I have a django app name "celery_tasks" with the following directory structure:
.
├── apps.py
├── emitter
├── __init__.py
├── kse
├── mongo
I have added a new module name kse which contains two files:
├── __init__.py
├── lol.py
The…

Kheshav Sewnundun
- 1,236
- 15
- 37
1
vote
1 answer
How to test your django model using shell
I am trying to learn Django and have a very simple question that I am not able to get around with. I have coded my Django model as:
class Work(models.Model):
STATES = (
('STARTED', 'started'),
('IN_PROGRESS', 'running'),
…

yguw
- 856
- 6
- 12
- 32
1
vote
3 answers
Django unique field ignored in interactive shell
I've defined a class called Country that has a unique name field.
class Country(models.Model):
class Meta:
verbose_name_plural = "Countries"
name = models.CharField(max_length=100, unique=True, null=False)
def __unicode__(self):
…

Kenny Rasschaert
- 529
- 4
- 24
1
vote
1 answer
Django: Unable to import models globally
I am running some python scripts which pertains with a django application.
So I manually made a folder (named scripts) that contains some python scripts but is not made using ./manage.py startapp scripts. Along with this folder there is a modelsapp…

CharcoalG
- 185
- 4
- 12
1
vote
1 answer
Django Shell in Eclipse not starting
I am getting this error message when I try to run the shell from Eclipse Neon while I can successfully run the Django shell from command window. I am using Python 3.4 and Django 1.10. Any idea where the problem is?
WSGI file:
'''
WSGI config for…

Ibo
- 4,081
- 6
- 45
- 65
1
vote
1 answer
How do I fill in nested ManyToMany fields in Django with Shell?
Have checked the questions on this topic on SO, of them many are outdated (dj<=1.4), so asking a new quesiton. I guess this is simple, I'm much beginner with Django and Python.
I have some models, of which there are nested ManyToManyFields,
I want…
user5170375
1
vote
0 answers
Trying to load CSV file into a SQL Database in the Django Shell
I am trying to import data from a CSV file into an SQL database through my Django Project. I have made my models and a separate function in Pandas that extracts the specific information that I need from the CSV file itself. I am trying to use the…

Felix Dasgupta
- 127
- 1
- 2
- 10
1
vote
1 answer
Why can I import a library from the Django shell, but not inside my site?
I am trying to use the oauth2app library inside my Django app. I've tried installing the library several ways (easy_install, pip, pip via a requirements file, etc.), and every time it installs just fine. Also every time I can import the library…

machineghost
- 33,529
- 30
- 159
- 234