Skip to content

Conversation

AyushDharDubey
Copy link
Collaborator

Closes #54

This PR introduces Delete Revision feature when the admin is on page /model/<model_id>/<revision>; and continues showing Delete Model option when the admin is on page /model/<model_id> instead.

Copy link
Collaborator

@lonvia lonvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general thought: are there anywhere places in the code where we assume that revision numbers for each model are continuous?

if not revision:
models = Model.objects.filter(model_id=model_id)
else:
models = Model.objects.filter(model_id=model_id, revision=revision)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a few corner cases here:

  1. if the latest revision is deleted, then the previous one needs to become latest.

  2. If the last available revision is deleted, the model is gone. If it wasn't the last revision it is still there.

Are these covered through automatic updates? Can we maybe have tests for that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I missed these, I will overwrite the model's delete method to handle latest and write tests to ensure.

@AyushDharDubey
Copy link
Collaborator Author

A general thought: are there anywhere places in the code where we assume that revision numbers for each model are continuous?

Most probably not. I have not seen any.

@AyushDharDubey AyushDharDubey requested a review from lonvia August 30, 2025 06:11
@lonvia lonvia merged commit 3603a9f into fossgis:main Sep 4, 2025
1 check passed
@AyushDharDubey AyushDharDubey deleted the fix/issue_54-add-delete-revision-feature branch September 20, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling of missing model files
2 participants