[Django] #36963: JSONField("ContactInfo", default=contact_default) i think you need to discribe more about the passed function

6 views
Skip to first unread message

Django

unread,
Mar 1, 2026, 6:56:24 AM (yesterday) Mar 1
to django-...@googlegroups.com
#36963: JSONField("ContactInfo", default=contact_default) i think you need to
discribe more about the passed function
-------------------------------------+-------------------------------------
Reporter: yousef_fadli | Type:
| Cleanup/optimization
Status: new | Component:
| Documentation
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
https://docs.djangoproject.com/en/6.0/ref/models/fields/#default


i think you need to describe more about the function in
`default=contact_default.`

The question is :
If this function is defined inside the actual class, should it be a
**static method** or a **class method** or a **normal object method** ?
thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/36963>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 1, 2026, 8:06:27 AM (yesterday) Mar 1
to django-...@googlegroups.com
#36963: JSONField("ContactInfo", default=contact_default) i think you need to
discribe more about the passed function
-------------------------------------+-------------------------------------
Reporter: yousef_fadli | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by shubh-gitpush):

The documentation says that the callable must expect no arguments. Django
invokes it without passing self or cls, defining it as a normal instance
method or class method would not work unless extra wrapping is used.

Therefore, if the callable is defined inside the model class, it would
need to be a @staticmethod, or alternatively be defined at module level.
--
Ticket URL: <https://code.djangoproject.com/ticket/36963#comment:1>

Django

unread,
Mar 1, 2026, 8:32:54 AM (yesterday) Mar 1
to django-...@googlegroups.com
#36963: JSONField("ContactInfo", default=contact_default) i think you need to
discribe more about the passed function
-------------------------------------+-------------------------------------
Reporter: yousef_fadli | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 6.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Clifford Gama):

* resolution: => invalid
* status: new => closed

Comment:

Closing per
https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
since I think the docs are pretty clear here.
--
Ticket URL: <https://code.djangoproject.com/ticket/36963#comment:2>

Django

unread,
Mar 1, 2026, 8:33:35 AM (yesterday) Mar 1
to django-...@googlegroups.com
#36963: JSONField("ContactInfo", default=contact_default) i think you need to
discribe more about the passed function
-------------------------------------+-------------------------------------
Reporter: yousef_fadli | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 6.0
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Clifford Gama):

Replying to [comment:2 Clifford Gama]:
> Closing per
https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
since I think the docs are clear.
--
Ticket URL: <https://code.djangoproject.com/ticket/36963#comment:3>
Reply all
Reply to author
Forward
0 new messages