1π
β
As stated in link below, you need to specify schema name and table name in db_table, so your Meta class for User should look like this (with default schema):
class Meta:
db_table = 'public"."user'
And for Car (assuming schema called "new"):
class Meta:
db_table = 'new"."car'
Donβt forget to migrate this.
π€COSHW
0π
I am assuming your suggesting something like this:
class User(models.Model):
name = models.CharField(max_length=200)
age = models.PositiveBigIntegerField()
class Meta:
db_table = 'user'
class Car(models.Model):
name = models.CharField(max_length=200)
model = models.PositiveBigIntegerField()
owner = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
class Meta:
db_table = 'car'
Here we are using a owner
in Car
model to create a relationship to User
model.
π€eagele
- [Answered ]-Django β Passing argument through href for URL dispatcher?
- [Answered ]-Run two different django-cms applications with different domains on the same ip on nginx
Source:stackexchange.com