Questions tagged [django-database]

django-database refers to database backends that Django supports out of the box

refers to database backends that Django supports out of the box.

This tutorial help you to make application using mongodb database. enter link description here

664 questions
0
votes
1 answer

A database query for each object in Django

I have a model Photos with a ForeignKey to the model User. If I print a photo objects fields in a template, e.g. {{ object.caption }} there will be 1 query, but if I print information about the user, e.g. {{…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
0
votes
1 answer

moving from Sqlite3 to mysql - how to copy all data

I'm currently using sqlite3 in my django app, but now that I'm moving to production, I thought it would be better to move it to mysql. I have a database file 9around 10 mb in size), and i want to copy all this data in the mysql db I created on prod.…
user_2000
  • 1,103
  • 3
  • 14
  • 26
0
votes
1 answer

Django Database querying differences

I am going through the creation of the Polls app again, in the Django Docs. I wanted to ask again about one particular thing they do in the django database. The code is shown below: >>> from polls.models import Poll, Choice # Make sure our…
Games Brainiac
  • 80,178
  • 33
  • 141
  • 199
0
votes
1 answer

How to Store Django Logs in a database?

I want to store my application logs (info and not error logs) in database so that further I can use it to display on web. Please suggest me a good approach.
0
votes
4 answers

How to retrieve the real SQL from the Django logger?

I am trying to analyse the SQL performance of our Django (1.3) web application. I have added a custom log handler which attaches to django.db.backends and set DEBUG = True, this allows me to see all the database queries that are being…
Amandasaurus
  • 58,203
  • 71
  • 188
  • 248
0
votes
1 answer

django-models database collations problems: declare a field that supports unicode?

I encountered this problem. When I cannot assign a unicode string to models.CharField . DatabaseError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='") I found this solution, but it…
CuriousMind
  • 15,168
  • 20
  • 82
  • 120
0
votes
2 answers

Modify the django models

I just tested it myself. I had Django models, and there have already been instances of the models in the database. Then I added a dummy integer field to a model and ran manage.py syncdb. Checked the database, and nothing happened to the table. I…
CuriousMind
  • 15,168
  • 20
  • 82
  • 120
0
votes
1 answer

Django: How to avoid reassigning ForeignKey on every save?

I want to save the A object and B object. A has a foreignkey to B. B has a OneToOneField to A. Is there a way I can get around having to reassign the variables between each save? or perhaps there's a better way to do it? # The models a and b were…
Sepero
  • 4,489
  • 1
  • 28
  • 23
0
votes
1 answer

How to get oracle NUMBER with syncdb

I have some legacy oracle database against which I run inspectdb command. One column in the DB has type NUMBER (without precision and scale) and what I got from django is: entity_id = models.DecimalField(unique=True, null=True, max_digits=0,…
mnowotka
  • 16,430
  • 18
  • 88
  • 134
0
votes
1 answer

mysql alter table stuck in preparing state

I recently tried to change a column in my database with a south migration for my django project from a CharField to a IntegerField I did a python manage.py schemamigration appname --auto i then applied the migration and it just hung. I stupidly ran…
Austin
  • 4,296
  • 6
  • 40
  • 52
0
votes
1 answer

Duplicate/Post django form on a non django website

I have a django site that has a donate form on it. This site handles only the internal donations by the organization. They have a public facing site that is not django driven. They want to have the same donation form for public users to submit…
Austin
  • 4,296
  • 6
  • 40
  • 52
0
votes
1 answer

How Extract Data from django admin site?

I have a django admin page but i don't have the database file on my computer. How can i extract all datas from the admin page in a databse file (e.g. MyDB.sqlite) on my hard disk ?
Kozet
  • 1,103
  • 1
  • 11
  • 19
0
votes
1 answer

simple reverse in query in django

I am trying to get country where some specific post exists, so that I can show only those countries. To do so. I have following code. Models: class Country(models.Model): name=models.CharField(max_length=100) …
Hafiz
  • 4,187
  • 12
  • 58
  • 111
0
votes
1 answer

How to update db with phpmyadmin when I add ForeignKey in django?

I have django model: #models.py class m1(models.Model): some_word = models.CharField() I've made db with 'manage.py syncdb' command and then added a ForeignKey field to a model #models.py from django.contrib.auth.models import User class…
Павел Тявин
  • 2,529
  • 4
  • 25
  • 32
-1
votes
1 answer

model doesn't have migrations

I am working on the Django model. I migrate all the files of the app, but it is showing me the model doesn't have migrations and also no migration file in the folder, but init.py file exists in the folder. Please give me suggestions. admin [X]…