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
2 answers

parse template tag to XML in Django

I am trying to print get some value from database and print into xml dynamically. This is my model: class Somemodel(models.Model): Party_Id = models.CharField(max_length=500) Label = models.CharField(max_length=500) Party_Id =…
Raja Simon
  • 10,126
  • 5
  • 43
  • 74
0
votes
1 answer

Number of different entries in Django database

I want to know whether there is a short way to get the number of different entries in a database column. For example i have different designs in my database and each design may include number of images.. What i want to learn is how many different…
0
votes
1 answer

rewrite sql query using Django db Api

These are my models in django class Match(models.Model): team_a = models.ForeignKey("Team", related_name="team_a") equipo_b = models.ForeignKey("Team", related_name="team_b") goals_team_a = models.IntegerField(default=0) goals_team_b…
Anyul Rivas
  • 655
  • 2
  • 12
  • 31
0
votes
1 answer

Do unit tests on the 'live' database in settings.py while using Django's 'manage.py test'

If you've got a database setup in Django, how can you have the TestRunner use the 'live' database (per the DATABASE_* settings in settings.py) instead of running them on the ephemeral test database. For example, I'd like to run the following test on…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
0
votes
2 answers

Django database not always available

I have specified multiple databases in settings.py. One of the databases is a local Oracle database which is only available on my computer at work. So when I open my site on a computer which does not have access to this Oracle database, I see the…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
0
votes
1 answer

what does the two table Users and auth_user in Django are for?

I know the functionality of User model in Django. but when I syncdb, I see of the many auth_* tables created, there is one auth_user. There is yet another User table. There are differences between them in the columns. I am attaching them here. when…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
0
votes
1 answer

Unnecessary many SQL queries in Django

In all my models I have a get_absolute_url() method as the one below, but with django-debug-toolbar I see that it costs many SQL queries. My objects are related in a tree structure, so a level 3 object only knows what level 1 object it is related to…
Jamgreen
  • 10,329
  • 29
  • 113
  • 224
0
votes
2 answers

Django does not let me update simple model to sqlite DB

I'm currently trying to get familiarized with django and I got stuck with an error I can't fix. My django version is 1.7a2 (from developer). My model is quite simple: from django.db import models class dataset(models.Model): ID =…
XNor
  • 638
  • 3
  • 8
  • 27
0
votes
1 answer

How to catch specific errors from modules that might not be available

I have a django project, where multiple database backends are supported. I want a check (in order to print a sensible error message to user) what the error on a ordinary queryset operator is e.g. I want to catch cx_Oracle.DatabaseError and…
Kimvais
  • 38,306
  • 16
  • 108
  • 142
0
votes
0 answers

Efficiently add a custom field to a QuerySet

I have a Django website with activities. When checking for optimisation opportunities with the django-toolbar, I discovered that the view for an activity's subscription list was really inefficient. It made five database request per subscription,…
Arthur C
  • 1,274
  • 1
  • 14
  • 34
0
votes
1 answer

using multiple databases in django and get table doesn't exist error

I have the following database settings in django: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'default_db', }, 'otherdb': { 'ENGINE': 'django.db.backends.mysql', 'NAME':…
Atma
  • 29,141
  • 56
  • 198
  • 299
0
votes
1 answer

Django Unable to show content from DB

I'm new with Django and i'm trying to show some data from my db but with no luck. The DB connection is OK and i did syncdb. I'm trying to iterate on one column of my database (logging) table (handleName) Model: class Handle(models.Model): …
Kobi K
  • 7,743
  • 6
  • 42
  • 86
0
votes
1 answer

saving data in static files to reduce query time

Im working on a Django app, where in a user can search using a combination of parameters from 3 lists(say A, B and C). Total no. of searches possible = len(A)xlen(B)xlen(C). For each search, a whole algorithm runs to bring data from the database,…
user_2000
  • 1,103
  • 3
  • 14
  • 26
0
votes
1 answer

How to create a query based on fields of another queryset

I have an app that saves Student quizzes using two models: StudentQuiz saves the questions the student was asked StudentQuestion saves the responses of the student for each of those questions. class StudentQuestion(models.Model): user =…
zaphod
  • 2,045
  • 1
  • 14
  • 18
0
votes
1 answer

Difference between Database name and 'name' parameter inside database

The question is self explanatory. Kindly provide the valuable knowledge. Thanks. DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'gingr_cc', 'USER': '', 'PASSWORD':…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267