Skip to content

Commit 81ce087

Browse files
committed
fix to_string() in Spectrum data
1 parent e6fe04e commit 81ce087

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proteins/models/spectrum.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from django.utils.text import slugify
66
from model_utils.models import TimeStampedModel
77
from model_utils.managers import QueryManager
8+
import json
89

910
from .mixins import Authorable, Product
1011
from ..util.helpers import wave_to_hex
@@ -85,12 +86,11 @@ def to_python(self, value):
8586
raise ValidationError('Invalid input for spectrum data')
8687

8788
# def get_db_prep_value(self, value, connection, prepared=False):
88-
# print('prep value')
89+
# print('prep value: ', value)
8990
# return super().get_db_prep_value(np.array(value).tolist(), connection, prepared)
9091

91-
# def value_to_string(self, obj):
92-
# print('to str')
93-
# return super().value_to_string(obj.tolist())
92+
def value_to_string(self, obj):
93+
return json.dumps(self.value_from_object(obj))
9494

9595
def validate(self, value, model_instance):
9696
super().validate(value, model_instance)

0 commit comments

Comments
 (0)