Skip to content

Commit ff94161

Browse files
author
Ross Mechanic
authored
Update documentation on F() expressions (#413)
1 parent aeae606 commit ff94161

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/reference.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ you use:
3939
from simple_history.middleware import HistoricalRecords
4040
if hasattr(HistoricalRecords.thread, 'request'):
4141
del HistoricalRecords.thread.request
42+
43+
Using F() expressions
44+
---------------------
45+
``F()`` expressions, as described here_, do not work on models that have
46+
history. Simple history inserts a new record in the historical table for any
47+
model being updated. However, ``F()`` expressions are only functional on updates.
48+
Thus, when an ``F()`` expression is used on a model with a history table, the
49+
historical model tries to insert using the ``F()`` expression, and raises a
50+
``ValueError``.
51+
52+
.. _here: https://docs.djangoproject.com/en/2.0/ref/models/expressions/#f-expressions

0 commit comments

Comments
 (0)