Django Create Foreign key to external table

tbo

I have a django app which works with a subset of tables within a database. What I want is to create a foreign key to a table which is not managed by the django app, reason is that I want to cascade on delete.

Is it possible to declare a foreign key in my django model to a table which is not controled by my django app?

Something like:

user = models.ForeignKey(table='external_table_name',field='user_id',
                         on_delete=models.SET_NULL)
RustyShackleford

You need to set meta options for your model to:

managed=False

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Django Create Foreign key to external table

From Dev

How to create foreign key in a table?

From Dev

Unable to create table with foreign key

From Dev

create a foreign key on a primary key of another table

From Dev

Create foreign key on table with large size

From Dev

TSQL: NOCHECK Foreign Key inside CREATE TABLE

From Dev

Can't create a table because a foreign key

From Dev

Couldn't create table with foreign key in sqlite

From Dev

Sqlite how to create table with Foreign key

From Dev

How to create forms for foreign key django

From Dev

Django ModelForm - Create instance with foreign key

From Dev

Django Foreign Key to Many to Many Table

From Dev

query foreign key table for list view in django

From Dev

Django model foreign key from existing table

From Dev

SQL create table primary key and foreign key syntax

From Dev

Create table with both foreign keys and a composite primary key

From Dev

how to create a Foreign-Key constraint to a subset of the rows of a table?

From Java

Why can't I properly create a table with a foreign key?

From Dev

MySQL Foreign Key, Can't create table (errno: 150)

From Dev

Create a foreign key to a table that is not part of the context in Code First

From Dev

Getting error on create table with foreign key constraint (Cascade)

From Dev

SQL: vertically split table and create/populate keys, foreign key relationship

From Dev

Syntax error in create table statement when using foreign key

From Dev

I am trying to create a table with only two foreign key

From Dev

Can't create table "Foreign Key constraint is incorrectly formed" SQL

From Dev

MariaDB create table throws error on foreign key contraint

From Dev

How to create table B like A with foreign key definitions?

From Dev

MySQL - Can't create table (errno: 150) - Foreign key constraints

From Dev

How do I create a table with a foreign key reference?

Related Related

  1. 1

    Django Create Foreign key to external table

  2. 2

    How to create foreign key in a table?

  3. 3

    Unable to create table with foreign key

  4. 4

    create a foreign key on a primary key of another table

  5. 5

    Create foreign key on table with large size

  6. 6

    TSQL: NOCHECK Foreign Key inside CREATE TABLE

  7. 7

    Can't create a table because a foreign key

  8. 8

    Couldn't create table with foreign key in sqlite

  9. 9

    Sqlite how to create table with Foreign key

  10. 10

    How to create forms for foreign key django

  11. 11

    Django ModelForm - Create instance with foreign key

  12. 12

    Django Foreign Key to Many to Many Table

  13. 13

    query foreign key table for list view in django

  14. 14

    Django model foreign key from existing table

  15. 15

    SQL create table primary key and foreign key syntax

  16. 16

    Create table with both foreign keys and a composite primary key

  17. 17

    how to create a Foreign-Key constraint to a subset of the rows of a table?

  18. 18

    Why can't I properly create a table with a foreign key?

  19. 19

    MySQL Foreign Key, Can't create table (errno: 150)

  20. 20

    Create a foreign key to a table that is not part of the context in Code First

  21. 21

    Getting error on create table with foreign key constraint (Cascade)

  22. 22

    SQL: vertically split table and create/populate keys, foreign key relationship

  23. 23

    Syntax error in create table statement when using foreign key

  24. 24

    I am trying to create a table with only two foreign key

  25. 25

    Can't create table "Foreign Key constraint is incorrectly formed" SQL

  26. 26

    MariaDB create table throws error on foreign key contraint

  27. 27

    How to create table B like A with foreign key definitions?

  28. 28

    MySQL - Can't create table (errno: 150) - Foreign key constraints

  29. 29

    How do I create a table with a foreign key reference?

HotTag

Archive