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

View File

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

View File

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

View File

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

View File

@ -10,6 +10,8 @@ from django.contrib.gis.db import models
from transfer.mixins import MigrateMixin from transfer.mixins import MigrateMixin
# models.ForeignKey(ForeignModel, models.DO_NOTHING, blank=True, null=True)
class Sites(MigrateMixin): class Sites(MigrateMixin):
using = 'legacy' using = 'legacy'
@ -215,7 +217,8 @@ class CityNames(MigrateMixin):
class CityPhotos(MigrateMixin): class CityPhotos(MigrateMixin):
using = 'legacy' 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_file_name = models.CharField(max_length=255, blank=True, null=True)
attachment_content_type = 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) geometries = models.CharField(max_length=1024, blank=True, null=True)
@ -745,7 +748,7 @@ class PageTexts(MigrateMixin):
body = models.TextField(blank=True, null=True) body = models.TextField(blank=True, null=True)
locale = models.CharField(max_length=255, blank=True, null=True) locale = models.CharField(max_length=255, blank=True, null=True)
state = 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() created_at = models.DateTimeField()
updated_at = models.DateTimeField() updated_at = models.DateTimeField()
summary = models.TextField(blank=True, null=True) summary = models.TextField(blank=True, null=True)