Hi,
Im getting a weird issue when adding data in my admin portal.
Internal Server Error: /admin/posts/response/add/
TypeError: can not serialize 'decimal.Decimal' object`
class Response(models.Model):
post = models.ForeignKey(Post, on_delete=models.CASCADE)
response = models.TextField(help_text="The response to the post")
created_at = models.DateTimeField(default=now)
scheduled_release = models.DateTimeField(help_text="The time the message should be released", null=True)
delivered = models.BooleanField(default=False, help_text="Indicates if the message was delivered")
abandoned = models.BooleanField(default=False, help_text="Indicates if the message was abandoned")
alpha_score = models.DecimalField(max_digits=5, decimal_places=2, default=0.0, help_text="The alpha score of the message", null=True)
linked_post = models.ManyToManyField(Post, related_name='linked_post', blank=True)
def __str__(self):
return self.response
class ResponseAdmin(admin.ModelAdmin):
# Add serach fields and list_display
search_fields = ('post__title', 'response')
list_display = ('post', 'response', 'created_at', 'scheduled_release', 'delivered', 'abandoned', 'alpha_score')
Im not sure what is going on here?
If i add data outside of the admin it seems to work.