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

Use new subclass with already in use database in django

I'm trying to create a customized User class inheriting from django User. Problem is I already have some users in database which can not be deleted whatsoever and also I have another class (let's say reports) which have a foreignkey to User. My…
Bahman Rouhani
  • 1,139
  • 2
  • 14
  • 33
0
votes
1 answer

django - linking the register form info to user profile model

I am trying to make a webapp that includes register/login operations. The login is working fine but the registration form is frustrating. I have a class registration form that inherits from UserCreationForm. The users are created and seen in the…
Andrew Serra
  • 153
  • 14
0
votes
1 answer

Check whether user is in django_db or no

I have the django model called "create-chat" and there I write names of people I want to see in a group chat. So. I created the model, but I don't know how to make a condition whether user is in django_db or no, if so then I want to show them the…
user8967235
0
votes
1 answer

Django Database: Saving a New Entry Wtihout Saving Its ForeignKeys First

Suppose I have a model structure like this: class Cheese(Model.models): type = models.CharField(max_length='50') class Sauce(Models.models): type = models.CharField(max_length='50') class Pizza(Models.models): cheese =…
user8951490
  • 833
  • 1
  • 10
  • 21
0
votes
1 answer

Convert Full Database to Different database Format using django

I'm switching my database engine and need to convert my data. I can access both databases in a python shell with .using('[database]'). Does django have any built-in backup&restore functions that I could use to fill my empty(but migrated) new…
Renoc
  • 419
  • 4
  • 13
0
votes
1 answer

What types of requests make good candidate for `@transaction.non_atomic_requests`?

A common way to handle transactions on the web is to wrap each request in a transaction. In Django, you can set ATOMIC_REQUESTS to True in the configuration of each database for which you want to enable this behavior. It works like this. Before…
Matt
  • 5,028
  • 2
  • 28
  • 55
0
votes
1 answer

How to config initial connection command for Django databases?

Can I do something like this in Django settings file: DATABASE = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'test.sqlite3', 'INITIAL_CMD': 'PRAGMA journal_mode=WAL', # here } } so that whenever…
adamsmith
  • 5,759
  • 4
  • 27
  • 39
0
votes
1 answer

Django DB Router Sending Table to default DB instead of Correct One

I am creating a site that will be connected to 4 databases. I got the first three going no problem. I created a separate app for each db then created a router for each one. The problem with the last db is that the router is not triggering. It keeps…
Joe
  • 2,641
  • 5
  • 22
  • 43
0
votes
1 answer

Configure Django Database Routers

I am trying to connect a new Django site to legacy DBs. From everything I can gather I need to create a database router. The docs refer to creating an app_label in the meta section of the model. This is what the router would match to. I have also…
Joe
  • 2,641
  • 5
  • 22
  • 43
0
votes
1 answer

what is no such column: REFERRED.number?

I'm trying to load a fixture and it gives me: django.db.utils.OperationalError: Problem installing fixtures: no such column: REFERRED.number Unfortunately, I cannot show the json, because there is all kind of private stuff in there, but I was…
JasonTS
  • 2,479
  • 4
  • 32
  • 48
0
votes
2 answers

How do you maintain user data when updating a Django site?

I have a live Django site that already has registered users. I am trying to update the site with a new version that is different from the original site -similar idea but different models. How can I keep the current users on the new site? I have…
Emile
  • 3,464
  • 8
  • 46
  • 77
0
votes
0 answers

Load data file into Django with one demo user

I am new to Django. I am planning to a have a demo user account and i want to load data based on demo user's UUID(user's id). Is there another way to load the seed file without using fixtures? seed file. User.objects.create( first_name =…
user7508299
  • 31
  • 1
  • 4
0
votes
3 answers

Django : looking for an implementation of an ldap db backend (or for any help on this)

Following this post (I was looking for a library allowing me to declare Django models on a ldap backend), I have decided to use ldapdb. After having played a while with this library, I figured out that it doesn't reach the level of control I need,…
sebpiq
  • 7,540
  • 9
  • 52
  • 69
0
votes
1 answer

How do I create a form in Django based off tables in my non default db?

Let's say I have class A and class B that belong in database Y which is not the default database in my Django application. class A(models.Model): attA = models.CharField(max_length = 1024) class B(models.Model): forA = models.ForgeinKey(A) …
tks
  • 55
  • 6
0
votes
1 answer

In Django how to do filter, followed by get queries and get a field value?

Following is a simplified models.py of one of the apps of my Django program: #This is the custom queryset manager class TenantManager(models.Manager): def for_tenant(self, tenant): return self.get_queryset().filter(tenant=tenant) #This is one…