Closed AndrewSaltz closed 7 years ago
Any fields you list in store
when you call watson.register(store=...)
must be JSON serializable.
For most cases, you don't need to add any fields to store
, unless you
need access to them via SearchEntry.meta in your search views.
On Wed, 12 Apr 2017 at 18:46 AndrewSaltz notifications@github.com wrote:
I apologize if any of this is wrong, I'm somewhat new.
I wrote a Django web app that works nicely. I used Watson as my search app, and that also went nicely. But when I tried to add an object within my app - either through the user interface or the admin. The error is " is not JSON serializable" , and the traceback leads to Watson. I tested this by removing my models from apps.py and everything worked again.
I did some reading on serializing, but I don't really use JSON. I also ran across this issue, which was quite over my head, although I'm happy to learn. I would appreciate if you could provide any help or point me in the right direction.
Here's the model that's giving Watson trouble:
class Teams(models.Model): team = models.AutoField(primary_key=True) sport = models.ForeignKey(Sports, models.DO_NOTHING, blank=True, null=True) division = models.CharField(max_length=225, blank=True, null=True) school = models.ForeignKey(School, models.DO_NOTHING, blank=True, null=True) coach = models.CharField(max_length=225, blank=True, null=True) nickname = models.CharField(max_length=225, blank=True, null=True) win = models.IntegerField(blank=True, null=True, default=0) loss = models.IntegerField(blank=True, null=True, default=0) tie = models.IntegerField(blank=True, null=True, default=0) pic = VersatileImageField(upload_to='teampics/', blank=True, default='/teampics/emptyfield.jpg')
class Meta: db_table = 'teams' def __str__(self): return '%s %s' % (self.school, self.sport)
Thank you!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/197, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCIZOiLcBH6GNos_uo2hTbIdZEFhCks5rvQ3dgaJpZM4M7wDH .
I apologize if any of this is wrong, I'm somewhat new.
I wrote a Django web app that works nicely. I used Watson as my search app, and that also went nicely. But when I tried to add an object within my app - either through the user interface or the admin. The error is "
I did some reading on serializing, but I don't really use JSON. I also ran across this issue, which was quite over my head, although I'm happy to learn. I would appreciate if you could provide any help or point me in the right direction.
Here's the model that's giving Watson trouble:
Thank you!