skip to Main Content

Get a Foreign Key value with django-rest-framework serializers – Postgresql

I'm using the django rest framework to create an API. models.py class DepartmentModel(models.Model): DeptID = models.AutoField(primary_key=True) DeptName = models.CharField(max_length=100) def __str__(self): return self.DeptName class Meta: verbose_name = 'Department Table' class EmployeeModel(models.Model): Level_Types = ( ('Genin', 'Genin'), ('Chunin', 'Chunin'), ('Jonin', 'Jonin'),…

VIEW QUESTION

Transform data from a jsonb column into a table in postgresql

I have a table which stores timestamps but they're in a jsonb array column like this: id cycles 5 [{"end": "2022-10-18T18:31:34.529667Z", "start": "2022-10-05T19:01:51.400124Z"}, {"start": "2022-10-28T08:27:13.682084Z"}] 6 [{"start": "2022-10-03T16:37:38.119236Z"}] 7 [{"end": "2022-11-14T11:30:17.964960Z", "start": "2022-11-08T19:20:20.413133Z"}] I need to the values from the…

VIEW QUESTION
Back To Top
Search