diff --git a/doc/development/implementation/logging.rst b/doc/development/implementation/logging.rst index bc5bc9eff..7d84884e5 100644 --- a/doc/development/implementation/logging.rst +++ b/doc/development/implementation/logging.rst @@ -100,17 +100,19 @@ Customizing log entry display The base ``LogEntryType`` classes allow for varying degree of customization in their descendants. -If you want to add another log message for an existing core object (e.g. an ``Order``, ``Item``, or ``Voucher``), you can inherit -from its predefined `LogEntryType`, e.g. `OrderLogEntryType`, and just specify a new plaintext string. You can use format -strings to insert information from the LogEntry's `data` object as shown in the section above. +If you want to add another log message for an existing core object (e.g. an :class:`Order `, +:class:`Item `, or :class:`Voucher `), you can inherit +from its predefined :class:`LogEntryType `, e.g. +:class:`OrderLogEntryType `, and just specify a new plaintext string. +You can use format strings to insert information from the LogEntry's `data` object as shown in the section above. If you define a new model object in your plugin, you should make sure proper object links in the user interface are -displayed for it. If your model object belongs logically to a pretix `Event`, you can inherit from `EventLogEntryType`, -and set the `object_link_*` fields accordingly. `object_link_viewname` refers to a django url name, which needs to -accept the arguments `organizer` and `event`, containing the respective slugs, and an argument named by `object_link_argname`. -The latter will contain the ID of the model object, if not customized by overriding `object_link_argvalue`. -If you want to customize the name displayed for the object (instead of the result of calling `str()` on it), -overwrite `object_link_display_name`. +displayed for it. If your model object belongs logically to a pretix :class:`Event `, you can inherit from :class:`EventLogEntryType `, +and set the ``object_link_*`` fields accordingly. ``object_link_viewname`` refers to a django url name, which needs to +accept the arguments `organizer` and `event`, containing the respective slugs, and an argument named by ``object_link_argname``. +The latter will contain the ID of the model object, if not customized by overriding ``object_link_argvalue``. +If you want to customize the name displayed for the object (instead of the result of calling ``str()`` on it), +overwrite ``object_link_display_name``. .. code-block:: python @@ -125,7 +127,7 @@ overwrite `object_link_display_name`. def object_link_display_name(self, order): return order.code -To show more sophisticated message strings, e.g. varying the message depending on information from the LogEntry's +To show more sophisticated message strings, e.g. varying the message depending on information from the :class:`LogEntry `'s `data` object, override the `display` method: .. code-block:: python @@ -145,7 +147,7 @@ To show more sophisticated message strings, e.g. varying the message depending o .. automethod:: pretix.base.logentrytypes.LogEntryType.display -If your new model object does not belong to an `Event`, you need to inherit directly from ``LogEntryType`` instead +If your new model object does not belong to an :class:`Event `, you need to inherit directly from ``LogEntryType`` instead of ``EventLogEntryType``, providing your own implementation of ``get_object_link_info`` if object links should be displayed. diff --git a/src/pretix/base/logentrytypes.py b/src/pretix/base/logentrytypes.py index 27c32b03c..ba3564c30 100644 --- a/src/pretix/base/logentrytypes.py +++ b/src/pretix/base/logentrytypes.py @@ -117,12 +117,12 @@ class LogEntryType: def get_object_link_info(self, logentry) -> dict: """ - Return information to generate a link to the content_object of a given logentry. + Return information to generate a link to the `content_object` of a given log entry. Not implemented in the base class, causing the object link to be omitted. - :return: `dict` with the keys `href` (containing a URL to view/edit the object) and `val` (containing the - escaped text for the anchor element) + :return: Dictionary with the keys ``href`` (containing a URL to view/edit the object) and ``val`` (containing the + escaped text for the anchor element) """ pass