We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d2351d commit acaee23Copy full SHA for acaee23
docs/src/piccolo/schema/advanced.rst
@@ -62,3 +62,24 @@ for example with ``table_finder`` (see :ref:`TableFinder`).
62
63
class Band(Table, tags=["music"]):
64
name = Varchar(length=100)
65
+
66
+-------------------------------------------------------------------------------
67
68
+Mixins
69
+------
70
71
+If you're frequently defining the same columns over and over again, you can
72
+use mixins to reduce the amount of repetition.
73
74
+.. code-block:: python
75
76
+ from piccolo.columns import Varchar, Boolean
77
+ from piccolo.table import Table
78
79
80
+ class FavouriteMixin:
81
+ favourite = Boolean(default=False)
82
83
84
+ class Manager(FavouriteMixin, Table):
85
+ name = Varchar()
0 commit comments