File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 11Changes
22=======
33
4+ 0.39.0
5+ ------
6+ Added ``to_dict`` method to ``Table``.
7+
8+ If you just use ``__dict__`` on a ``Table`` instance, you get some non-column
9+ values. By using ``to_dict`` it's just the column values. Here's an example:
10+
11+ .. code-block:: python
12+
13+ class MyTable(Table):
14+ name = Varchar()
15+
16+ instance = MyTable.objects().first().run_sync()
17+
18+ >>> instance.__dict__
19+ {'_exists_in_db': True, 'id': 1, 'name': 'foo'}
20+
21+ >>> instance.to_dict()
22+ {'id': 1, 'name': 'foo'}
23+
24+ Thanks to @wmshort for the idea, and @aminalaee and @sinisaos for investigating
25+ edge cases.
26+
4270.38.2
528------
629Removed problematic type hint which assumed pytest was installed.
Original file line number Diff line number Diff line change 1- __VERSION__ = "0.38.2 "
1+ __VERSION__ = "0.39.0 "
You can’t perform that action at this time.
0 commit comments