tcms.core.history module

class tcms.core.history.KiwiHistoricalRecords(verbose_name=None, verbose_name_plural=None, bases=(<class 'django.db.models.base.Model'>, ), user_related_name='+', table_name=None, inherit=False, excluded_fields=None, history_id_field=None, history_change_reason_field=None, user_model=None, get_user=<function _default_get_user>, cascade_delete_history=False, custom_model_name=None, app=None, history_user_id_field=None, history_user_getter=<function _history_user_getter>, history_user_setter=<function _history_user_setter>, related_name=None, use_base_model_db=False, user_db_constraint=True, no_db_index=[], excluded_field_kwargs=None, m2m_fields=(), m2m_fields_model_field_name='_history_m2m_fields', m2m_bases=(<class 'django.db.models.base.Model'>, ))[source]

Bases: HistoricalRecords

This class will keep track of what fields were changed inside of the history_change_reason field. This gives us a crude changelog until upstream introduces their new interface.

finalize(sender, **kwargs)[source]

Connect the pre_save signal handler after calling the inherited method.

post_save(instance, created, using=None, **kwargs)[source]

Calculate the changelog and call the inherited method to write the data into the database.

pre_save(instance, **kwargs)[source]

Signal handlers don’t have access to the previous version of an object so we have to load it from the database!

class tcms.core.history.ReadOnlyHistoryAdmin(model, admin_site)[source]

Bases: SimpleHistoryAdmin

Custom history admin which shows all fields as read-only.

Diff(obj)[source]
get_readonly_fields(request, obj=None)[source]

Hook for specifying custom readonly fields.

history_list_display = ['Diff']
property media
response_change(request, obj)[source]

Determine the HttpResponse for the change_view stage.

tcms.core.history.diff_objects(old_instance, new_instance, fields)[source]

Diff two objects by examining the given fields and return a string.

tcms.core.history.history_email_for(instance, title)[source]

Generate the subject and email body that is sent via email notifications post update!