We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The text was updated successfully, but these errors were encountered:
Думаю имеет смысл сохранять историю для Page, Book, Article и Diverse.
Page
Book
Article
Diverse
Модель Document имеет Мета класс со значением abstract = True
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
history = HistoricalRecords()
Sorry, something went wrong.
No branches or pull requests
DoD
Tasks
Requirements Gathering
Backend Development
Frontend Development
Version Control
Testing
The text was updated successfully, but these errors were encountered: