Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to change the
status
of a Student when a year sincestatus = ACEPTADO
has passed.First, I tried to implement it so it was done automatically, ie asynchronously. However, since Django is a synchronous framework it, would have to be done with third-party libraries. By researching this, I saw that this approach was more complicated than it seemed and didn't seem worth it.
So, what I did was introduce a field in Student called
acceptance_date
. I have overridden the retrieve method do that every time a GET is made, it checks if it has been more than a year since acceptance_date. If more than a year has passed, the status changes to RECHAZADO.Note for Frontend developers: When a Student is created, the
acceptance_date
should be left null (don't send anything to backend). When the admin accepts the Student, then you should send the acceptance_date as Date.today.