From 58994c596cadbc56cb1256f942f4f6bb7639a325 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Fri, 19 Jul 2024 15:44:35 +0300 Subject: [PATCH] foreign key --- back/tgbot/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/tgbot/models.py b/back/tgbot/models.py index a09dc0e..29196b4 100644 --- a/back/tgbot/models.py +++ b/back/tgbot/models.py @@ -1,7 +1,7 @@ import uuid from django.db import models -from tmc.models import CustomTable, BaseCustomField +from tmc.models import CustomTable, BaseCustomField, TerritoryItem import logging @@ -37,6 +37,7 @@ class TgItem(models.Model): ) user_id = models.BigIntegerField() name = models.CharField(max_length=255) + location = models.ForeignKey(TerritoryItem, models.RESTRICT) created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True) updated_at = models.DateTimeField(auto_now=True, null=True, blank=True) tmc = models.ManyToManyField(TmcElement)