From 586812e5c692063ce94fbed6858f272d9bc00797 Mon Sep 17 00:00:00 2001
From: Matthias <matthias.mair@oewf.org>
Date: Tue, 5 Apr 2022 00:23:09 +0200
Subject: [PATCH] add doc for generic mixin

---
 InvenTree/plugin/models.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/InvenTree/plugin/models.py b/InvenTree/plugin/models.py
index 6e81df9b48..141318f05f 100644
--- a/InvenTree/plugin/models.py
+++ b/InvenTree/plugin/models.py
@@ -103,8 +103,34 @@ class PluginConfig(models.Model):
 
 
 class GenericSettingClassMixin:
+    """
+    This mixin can be used to add reference keys to static properties
 
+    Sample:
+    ```python
+    class SampleSetting(GenericSettingClassMixin, common.models.BaseInvenTreeSetting):
+        class Meta:
+            unique_together = [
+                ('sample', 'key'),
+            ]
+
+        REFERENCE_NAME = 'sample'
+
+        @classmethod
+        def get_setting_definition(cls, key, **kwargs):
+            # mysampledict contains the dict with all settings for this SettingClass - this could also be a dynamic lookup
+
+            kwargs['settings'] = mysampledict
+            return super().get_setting_definition(key, **kwargs)
+
+        sample = models.charKey(  # the name for this field is the additonal key and must be set in the Meta class an REFERENCE_NAME
+            max_length=256,
+            verbose_name=_('sample')
+        )
+    ```
+    """
     # region generic helpers
+
     REFERENCE_NAME = None
 
     def _get_reference(self):