Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b9d5f4

Browse files
fix(GeneratedField): Require db_persist argument in the signature.
1 parent30e0a43 commit8b9d5f4

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

‎AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ answer newbie questions, and generally made Django that much better:
478478
Jarek Głowacki <jarekwg@gmail.com>
479479
Jarek Zgoda <jarek.zgoda@gmail.com>
480480
Jarosław Wygoda <jaroslaw@wygoda.me>
481+
Jason Cameron <https://jasoncameron.dev>
481482
Jason Davies (Esaj) <https://www.jasondavies.com/>
482483
Jason Huggins <http://www.jrandolph.com/blog/>
483484
Jason McBrayer <http://www.carcosa.net/jason/>

‎django/db/models/fields/generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class GeneratedField(Field):
1515
_query=None
1616
output_field=None
1717

18-
def__init__(self,*,expression,output_field,db_persist=None,**kwargs):
18+
def__init__(self,*,expression,output_field,db_persist,**kwargs):
1919
ifkwargs.setdefault("editable",False):
2020
raiseValueError("GeneratedField cannot be editable.")
2121
ifnotkwargs.setdefault("blank",True):

‎docs/ref/models/fields.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ when :attr:`~django.forms.Field.localize` is ``False`` or
12781278
``GeneratedField``
12791279
------------------
12801280

1281-
.. class:: GeneratedField(expression, output_field, db_persist=None, **kwargs)
1281+
.. class:: GeneratedField(expression, output_field, db_persist, **kwargs)
12821282

12831283
A field that is always computed based on other fields in the model. This field
12841284
is managed and updated by the database itself. Uses the ``GENERATED ALWAYS``

‎tests/model_fields/test_generatedfield.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ def test_database_default_unsupported(self):
9595

9696
deftest_db_persist_required(self):
9797
msg="GeneratedField.db_persist must be True or False."
98-
withself.assertRaisesMessage(ValueError,msg):
99-
GeneratedField(
100-
expression=Lower("name"),output_field=CharField(max_length=255)
101-
)
10298
withself.assertRaisesMessage(ValueError,msg):
10399
GeneratedField(
104100
expression=Lower("name"),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp