created delete field
This commit is contained in:
parent
b2184eb5c3
commit
2ba26c942b
|
@ -76,8 +76,9 @@ class TgBotUpdater:
|
|||
class TgbotConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "tgbot"
|
||||
|
||||
def ready(self):
|
||||
if not TgBotUpdater.is_run and os.environ.get("RUN_MAIN", None) != "true":
|
||||
if not TgBotUpdater.is_run and os.environ.get("RUN_MAIN", None) == "true":
|
||||
threading.Thread(
|
||||
target=(TgBotUpdater().run_func),
|
||||
name="tg_updater_thread",
|
||||
|
|
|
@ -19,7 +19,7 @@ class Element(models.Model):
|
|||
tmc = models.ForeignKey(CustomTable, models.RESTRICT)
|
||||
name = models.CharField()
|
||||
photoid = models.CharField()
|
||||
photo = models.ImageField(null=True, upload_to=group_based_upload_to)
|
||||
# photo = models.ImageField(null=True, upload_to=group_based_upload_to)
|
||||
text = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -27,16 +27,16 @@ class Element(models.Model):
|
|||
|
||||
class TgItem(models.Model):
|
||||
id = models.UUIDField(
|
||||
auto_created=True,
|
||||
# auto_created=True,
|
||||
primary_key=True,
|
||||
default=uuid.uuid4,
|
||||
editable=False,
|
||||
unique=True,
|
||||
)
|
||||
user_id = models.BigIntegerField()
|
||||
name = models.CharField(max_length=255, unique_for_month=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
updated_at = models.DateTimeField(auto_now=True)
|
||||
name = models.CharField(max_length=255)
|
||||
# created_at = models.DateTimeField(auto_now_add=True)
|
||||
# updated_at = models.DateTimeField(auto_now=True)
|
||||
tmc = models.ManyToManyField(CustomTable)
|
||||
element = models.ManyToManyField(Element)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ logger = logging.getLogger("root")
|
|||
class TgItemViewSet(viewsets.ModelViewSet):
|
||||
queryset = TgItem.objects.all()
|
||||
serializer_class = TgItemSerializer
|
||||
http_method_names = ["post"]
|
||||
|
||||
def create(self, request, *args, **kwargs):
|
||||
TgBotUpdater.my_queue.put(
|
||||
|
|
Loading…
Reference in New Issue