Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As an admin, I want to view the change history of a text to keep track of all the modifications made over time. #2

Open
11 tasks
khashashin opened this issue Sep 23, 2023 · 1 comment

Comments

@khashashin
Copy link
Owner

khashashin commented Sep 23, 2023

DoD

  • The change history of texts accurately records all modifications including who made the changes and when.
  • Admins can easily access and navigate through the change history from the admin UI.
  • The system supports rollback functionalities to revert to a previous version of the text.

Tasks

Requirements Gathering

Backend Development

  • Create an API endpoint to retrieve the change history of a text.
  • Set up a database structure to store detailed change logs, including timestamps and the identity of the admin who made each change.

Frontend Development

  • Develop a user interface that displays the change history in a readable and navigable format.
  • Implement features that allow admins to filter and search through the change history.
  • Create a viewing option to compare different versions of the text side by side.

Version Control

  • Integrate a version control system to track changes and facilitate rollbacks to previous versions.
  • Develop functionalities to allow admins to tag specific versions of the text, facilitating easier referencing in the future.

Testing

  • Prepare unit tests to ensure the change history is recorded accurately and reliably.
  • Perform integration tests to validate the smooth integration with the existing admin UI and database systems.
@khashashin
Copy link
Owner Author

Думаю имеет смысл сохранять историю для Page, Book, Article и Diverse.

Модель Document имеет Мета класс со значением abstract = True

abstract = True - по сути создает только слепок обекта, на основе такой модели в базе данных не будет создана таблица https://docs.djangoproject.com/en/4.2/topics/db/models/#abstract-base-classes

Так же я бы посмотрел готовые решения, например: https://django-simple-history.readthedocs.io/en/latest/

Используя данную библиотеку можно было бы сохранять историю изменений не имплементируя всю логику самим. Например:

#models.py

from simple_history.models import HistoricalRecords


class Document(models.Model):
    # ...
    history = HistoricalRecords()

    def __str__(self):
        return self.title

    class Meta:
        abstract = True

class Page(models.Model):
    # ...
    history = HistoricalRecords()

Добавляя history = HistoricalRecords() в Document модель мы соответственно добавляем историю изменений ко всем моделям наследованных он Document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant