Skip to content
Snippets Groups Projects
Commit 482b6e37 authored by Fanna Lautenbach's avatar Fanna Lautenbach
Browse files

Merge branch 'fix-json-field' into 'main'

change JSONField to postgres JSONField to work with json blobs

See merge request !44
parents 601e61da e8b208db
Branches
Tags
1 merge request!44change JSONField to postgres JSONField to work with json blobs
Pipeline #41421 passed
# Generated by Django 3.2 on 2022-12-15 15:01
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lofardata', '0013_auto_20221214_1338'),
]
operations = [
migrations.AlterField(
model_name='dataproduct',
name='additional_meta',
field=django.contrib.postgres.fields.jsonb.JSONField(),
),
]
import logging import logging
from celery.result import AsyncResult from celery.result import AsyncResult
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField from django.contrib.postgres.fields import ArrayField, JSONField
from django.db import models, IntegrityError from django.db import models, IntegrityError
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -18,7 +17,7 @@ class DataProduct(models.Model): ...@@ -18,7 +17,7 @@ class DataProduct(models.Model):
activity = models.CharField(max_length=50) activity = models.CharField(max_length=50)
surl = models.CharField(max_length=200, unique=True) surl = models.CharField(max_length=200, unique=True)
filesize = models.PositiveBigIntegerField() filesize = models.PositiveBigIntegerField()
additional_meta = models.JSONField() additional_meta = JSONField()
@staticmethod @staticmethod
def insert_dataproduct( def insert_dataproduct(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment