Relational integers to ForeignKey

This commit is contained in:
michail 2019-10-14 15:48:26 +05:00
parent 8ca27c7f87
commit a223832241
5 changed files with 16 additions and 13 deletions

View File

@ -50,8 +50,8 @@ card = {
# как работать с ManyToManyField - ? "EstablishmentSubType", "schedule"
"relations": {
"Locations": [
(("location_id", "id"),
("Address", "address", "id", "PositiveIntegerField")),
(("location", None),
("Address", "address", None, None)),
],
"Establishment": [#TODO правильно ли заполнена связь с EstablishmentType - ?
(("type", "type"),
@ -79,8 +79,8 @@ card = {
},
"relations": {
"Establishments": [
(("establishment_id", "id"),
("Establishment", "establishment", "id", "PositiveIntegerField"))
(("establishment", None),
("Establishment", "establishment", None, None))
]
}
},
@ -110,8 +110,8 @@ card = {
},
"relations": {
"Establishments": [
(("establishment_id", "id"),
("Establishment", "establishment", "id", "PositiveIntegerField"))
(("establishment", None),
("Establishment", "establishment", None, None))
]
}
}

View File

@ -114,7 +114,7 @@ card = {
}
},
"CityPhotos": {
"key": ("city_id", "id"),
"key": "city",
"fields": {
"coordinates": "geometries"
}
@ -144,8 +144,8 @@ card = {
},
"relations": {
"Cities": [ #TODO: Locations ссылается внешним ключом на Cities
(("city_id", "id"),
("City", "city", "id", "PositiveIntegerField"))
(("city", None),
("City", "city", None, None))
]
}
}

View File

@ -63,7 +63,7 @@ card = {
},
"relations": {
"PageTexts": {
"key": "page_id",
"key": "page",
"fields": {
"title": ("title", "TJSONField"),
"description": ("body", "TJSONField"),

View File

@ -71,7 +71,7 @@ card = {
},
"relations": {
"PageTexts": {
"key": "page_id",
"key": "page",
"fields": {
"title": ("title", "TJSONField"),
"description": ("body", "TJSONField")

View File

@ -10,6 +10,8 @@ from django.contrib.gis.db import models
from transfer.mixins import MigrateMixin
# models.ForeignKey(ForeignModel, models.DO_NOTHING, blank=True, null=True)
class Sites(MigrateMixin):
using = 'legacy'
@ -215,7 +217,8 @@ class CityNames(MigrateMixin):
class CityPhotos(MigrateMixin):
using = 'legacy'
city_id = models.IntegerField(blank=True, null=True)
# city_id = models.IntegerField(blank=True, null=True)
city = models.ForeignKey(Cities, models.DO_NOTHING, blank=True, null=True)
attachment_file_name = models.CharField(max_length=255, blank=True, null=True)
attachment_content_type = models.CharField(max_length=255, blank=True, null=True)
geometries = models.CharField(max_length=1024, blank=True, null=True)
@ -745,7 +748,7 @@ class PageTexts(MigrateMixin):
body = models.TextField(blank=True, null=True)
locale = models.CharField(max_length=255, blank=True, null=True)
state = models.CharField(max_length=255, blank=True, null=True)
page_id = models.IntegerField()
page = models.ForeignKey(Pages, models.DO_NOTHING, blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
summary = models.TextField(blank=True, null=True)