captkirk96 / same_django

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Sweep: <Foo object at ...> is not JSON serializable #6

Open captkirk96 opened 8 months ago

captkirk96 commented 8 months ago

Model cluster does not support primary keys that are not of simple types.

If you have a primary key that uses something like this CashField from django's tests that doesn't inherit from one of the basic types known to the DjangoJSONEncoder then you get <Foo object at ...> is not JSON serializable.

The Cash object I linked to inherits from decimal.Decimal but that is because it is only a simple example for testing.

ModelCluster needs to do some sort of is_serializable check at https://github.com/torchbox/django-modelcluster/blob/c72110e7789415196336584c70b2706fe74dbc2d/modelcluster/models.py#L44 and use Field.value_to_string or the like if the object isn't serializable

sweep-ai[bot] commented 8 months ago
Sweeping

0%

Actions (click)


❌ Unable to Complete PR

You ran out of the free tier GPT-4 tickets! We no longer support running Sweep with GPT-3.5 as it is too unreliable. Here are your options:


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.

This is an automated message generated by Sweep AI.