python - Use foreign keys in unmanaged model in Django -
I have some unmanaged models to get data from Oracle Database, but I can not read anything in the documentation about joining tables.
I have these models
class Model1 (models.Model): id = Models.CharField (max_length = 200, primary_key = true) name = model.carfield (max_length = 200, empty = true, empty = true) = meta: managed = incorrect db_table = 'table_1_name' class Model2 (models.Model): Model1_id = models.CharField (max_length = 200, empty = true, zero = true) Class meta: Managed = Wrong db_table = 'table_2_name' And in tables I model 1 and model 2 I am trying to join.
I thought I would get the data with Model1 = models.ForeignKey (Model1) in obj.model1__name , but I did not work it can do.
The problem is nothing with unmanaged models - this is just a question of syntax.
The foreign declaration is correct, but related information is used through dot syntax: obj.model1.name .
Comments
Post a Comment