title: How to implement a database for storing parentId and a list of children?
body: <p>I need to implement a POST request with data loading via two keys: <code>&quot;items&quot;</code> and <code>&quot;UpdateDate&quot;</code>.
  But in the database with items it is necessary to store the parent (<code>parentId</code>) of the category /product and a list of children (<code>children</code>).
  and record the time from the <code>&quot;UpdateDate&quot;</code> key in the date field for all categories/products imported for this request
  The screenshots below show a detailed TT.</p>
  <p>I haven't been able to figure out how to implement a database on Django/Django Rest Framework for a week.
  Screens:</p>
  <pre><code>class ShopUnit(models.Model):
      id = models.UUIDField(primary_key=True, verbose_name='Unique identifier', default=uuid.uuid4, editable=False,
                                null=False)
      name = models.CharField(max_length=255, verbose_name='Category/Product name', null=False)
      date = models.ForeignKey('Date', on_delete=models.CASCADE, related_name='date', null=True, blank=True)
      parentId = models.ForeignKey(&quot;self&quot;, on_delete=models.CASCADE, null=True, blank=True, related_name='сhilden',
                                       db_index=True)
      type = models.CharField(max_length=10, verbose_name='Element Type', choices=ShopUnitType.choices)
      price = models.PositiveIntegerField(null=True, blank=True, verbose_name='Цена')
      children = models.ForeignKey(&quot;self&quot;, null=True, blank=True, on_delete=models.SET_NULL, related_name='parent')
  </code></pre>
  <p>There are small developments:</p>
  <pre><code>https://i.stack.imgur.com/GdAaK.png
  https://i.stack.imgur.com/fzBdS.png
  https://i.stack.imgur.com/LRQIq.png
  https://i.stack.imgur.com/tssis.png
  </code></pre>