Создал модель
from django.db import models
from django.contrib.postgres.fields import ArrayField
class VKGROUPREQUESTS(models.Model):
id_group = models.CharField(max_length=100)
count_posts = models.IntegerField(default=0)
date_time_request = models.DateField(auto_now_add=True)
file_path = models.CharField(max_length=256, blank=True)
data = ArrayField(models.CharField(max_length=200), blank=True)
def __str_(self):
return self.id_group
class Meta:
ordering = ['id_group']
verbose_name = 'Запрос'
verbose_name_plural = 'Запросы'
class VKGROUP(models.Model):
id_group = models.ForeignKey(VKGROUPREQUESTS, on_delete=models.CASCADE)
@property
def __str__(self):
return self.id_group
class Meta:
ordering = ['id_group']
verbose_name = 'Группа ВК'
verbose_name_plural = 'Группы ВК'
Команда makemigrations проходит на ура , но вот при команде migration вылетает ошибка:
File "C:\Program Files\Anaconda\lib\json\encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'datetime' is not JSON serializable
БД - Postgres