As a side-note, are invoices supposed to work in a federation? There are several fields with constraints (NOT NULL, NOT BLANK) which isn't possible at the moment djangoldp-packages/djangoldp#224
Replicated this and found multiple (backend) bugs.. You weren't getting a 403?
Provisional estimate of 5h for this, based on the last issue. @balessan the budget I asked for to extend the unit tests in serializer overlaps with this... ideally I could have something like 8h to methodically work through everything, fixing this as part of it
We're literally just about to freeze for Plup's changes though so I think it might be a week until we can merge this @matthieu ... is that okay?
Agree! I was supposed to reach back to Berangere with the demo this week, but if it's not ready, who is reaching back with udpates? @alexbourlier maybe?
@matthieu I started expanding the unit tests for this yesterday but could you delay the demo until next Wednesday if possible please? That would give us plenty of time
class Batch(Model): invoice = models.ForeignKey(CustomerInvoice, on_delete=models.CASCADE, related_name='batches')
The issue is that when LDPSerializer analyses the Batch model it receives, it reads that the invoice key is not defined and throws a ValidationError. We can't just send that key explicitly (like we have in the past), because in this example the nested Tasks don't know the urlid of their parent Batch because it hasn't been created yet
If we define it like this:
class Batch(Model): title = models.CharField(max_length=255, blank=True, null=True)class Invoice(Model): batches = models.ManyToManyField(Batch, blank=True)
Then we workaround the issue, because we are first creating a version of the Batch model which does not require an invoice field, and then attaching it to the invoice after creation (LDPSerializer.attach_related_object)
This could be the quick fix which gets the HD Paris demonstration to work ASAP @matthieu@balessan ?
This workaround is not suitable when we need to store information on the through-model, e.g. djangoldp_circle.CircleMember is a through-model which adds a field is_admin. A through-model is a model which sits between two models in a many-to-many relationship, in this case CircleMember is between Circle and user
For a proper fix I believe that it should be possible for LDPSerializer to inject the connecting fields such as invoice and batch to complete the request. I've opened an issue for this here: djangoldp-packages/djangoldp#333
This is obviously harder and I'd rather do it without clients waiting urgently for it
Cache issue. Looks like changing the relationships hasn't fixed the issue though, the screenshot above is of a creation and the bug is for PUT requests