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

Applying django.db.backends modifications to entire project

So i needed to make implement own CursorWrappedDebug to log error queries too (in file django.db.backends.utils.py). I've done: logger = logging.getLogger('django.db.backends') class CustomCursorDebugWrapper(CursorWrapper): def execute(self,…
user13047221
0
votes
1 answer

Django how to check for empty value in IntegerField?

I am trying to get the set of objects which have no value for the field units The only way I can find to do this on the internet is by using objects.filter(units__exact = '') but this does not work for me as my field units is of type int, so I get a…
0
votes
1 answer

Django connect to IBM Cloud database

I'm new in Django. I'm trying to connect Django app to IBM Cloud db, I loaded my data IBM cloud and created credionals. Then installed ibm_db_django $ easy_install ibm_db_django Then in setting.py did import import ibm_db_django Then I added…
Mika
  • 75
  • 1
  • 8
0
votes
1 answer

Django Unhasable Type List even though im passing in an object ?(many to many field)

I am trying to run a migration script for my django app, but I keep getting TypeError: unhashable type: 'list' even though I am clearly passing in an Object: I get: error line 87, in buildCisc c.exclusions.add(exclus) line 944, in add …
0
votes
1 answer

Django filter queryset on list of "lists"

Excuse the phrasing of the title, perhaps it's not the correct way of saying it but I can't come up with a better one. I have a model called People, and through some means of identifying a bunch of people I want to fetch from the database by knowing…
Simen Russnes
  • 2,002
  • 2
  • 26
  • 56
0
votes
1 answer

Django test database is using local db.sqlite3, not running in memory

When I run Django tests that inserts data into the database, it will insert to my local db.sqlite3 and preserve it when the tests finishes. I don't want this to happen, and it shouldn't be according to the docs: Regardless of whether the tests pass…
Fawwaz Yusran
  • 1,260
  • 2
  • 19
  • 36
0
votes
2 answers

How to read Objects from ManyToMany Relation class in django

I have made a class called friend where i want to connect users as followers. Here From this class i am unable to read the users those are following another user. For Eg if 'a' user fllows 'b' user. Then i want to get the names of user that followed…
0
votes
0 answers

Django fix existing database according to migrations

I inherited a django (1.11.6, database PostgreSQL) project and I am new with it. Recently I noticed that some tables differ from the ones generated by manage.py sqlmigrate for instance, manage.py inspectdb returns class TheClass(models.Model): …
0
votes
1 answer

Django template object return empty value

I filter a subject from database: subject = Subject.objects.filter(id=1) I tried to call it form template: {{ subject.name|safe }} It return empty value. Do I need to loop the object? It just return a single records: >>> subject[0].name u'010-01…
kelvinfix
  • 2,915
  • 8
  • 37
  • 49
0
votes
1 answer

Django: Improve page load time by executing complex queries automatically over night and saving result in small lookup table

I am building a dashboard-like webapp in Django and my view takes forever to load due to a relatively large database (a single table with 60.000 rows...and growing), the complexity of the queries and quiet a lot of number crunching and data…
Daniel
  • 963
  • 1
  • 12
  • 29
0
votes
1 answer

How to Validate and Compare Data against the Database in DetailView - Django

I have a ChallengeDetailView which shows the details of a challenge like a blog post. I also have a form field on the same page and it supposed to get an answer of a challenge, and compare it to the database. So far here is what I did; class…
akyayik
  • 664
  • 1
  • 8
  • 25
0
votes
1 answer

In django which model feilds is required for data which having comma like in csv file 1 colunm having multiple data i.e. French, Japanese, Desserts

I am creating CRUD api in django rest framework sqlite3 database. I want to create model for restaurant which having some feilds which is [Restaurant ID, Restaurant Name, Cuisines, Average Cost for two, Currency, Has Table booking, Has Online…
0
votes
0 answers

Is it possible to access the Models/Database Entries that are present in a different project? [DB names are same in settings]

I am working on 3 different Django Projects named frontend,API,Backend. I have successfully implemented a custom Admin Interface as Backend, A middle layer for API request/Response and a Front End for consuming those APi's [without using Python &…
Deshwal
  • 3,436
  • 4
  • 35
  • 94
0
votes
0 answers

How do I condense annotated queryset results based on a particular field?

Here's a fun one. Maybe someone can figure this out. Say I have a queryset something like the one below and want to get leads by month per company. Company.objects.annotate( month=TruncMonth('leads__date_received') …
0
votes
1 answer

How can i confirm a database entry in django admin?

I have been working around this problem. I have a user submitting a HTML form lets say to list their hotel on my website. I need to review this form before i add it into my hotels model to be published. One approach i have worked on is to use a…