[Django] #17122: Admin inlines and forms do not support custom model fields that store non-unicode data in the database to be the primary key referenced by relation fields.

17 views
Skip to first unread message

Django

unread,
Oct 26, 2011, 9:22:12 PM10/26/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------
Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields because they call force_unicode() on raw database data when
rendering widgets and determining if data has changed.

A simple solution is to call the custom field's to_python method where
this occurs because to_python supports the raw database data and will
return an object that supports unicode transformation.

--
Ticket URL: <https://code.djangoproject.com/ticket/17122>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 26, 2011, 9:23:23 PM10/26/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by nickname123):

* cc: nickname123 (added)
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:1>

Django

unread,
Oct 26, 2011, 9:27:02 PM10/26/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------

Comment (by nickname123):

The patch I just uploaded adds support for ForeignKey and ManyToManyField
relations.

The OneToOneField is not in this patch. I believe a design decision
discussion would be required to implement OneToOneField support because it
would have to pass its relation to the widget and currently does not do
so.

--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:2>

Django

unread,
Oct 27, 2011, 10:55:28 PM10/27/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------

Comment (by nickname123):

I was mistaken about the OneToOne relation. I overlooked the
RelatedFieldWidgetWrapper in django.contrib.admin.widgets. I now have
this working for all relation fields. Inlines are also fixed. I will
submit a new patch soon. I am working on tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:3>

Django

unread,
Nov 1, 2011, 1:06:10 PM11/1/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by nickname123):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:4>

Django

unread,
Nov 1, 2011, 1:06:13 PM11/1/11
to django-...@googlegroups.com
#17122: Admin inlines and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by nickname123):

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:5>

Django

unread,
Nov 2, 2011, 3:34:37 PM11/2/11
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:6>

Django

unread,
Nov 3, 2011, 10:43:34 PM11/3/11
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+--------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by nickname123):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:7>

Django

unread,
Nov 26, 2011, 9:28:02 AM11/26/11
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-------------------------------------+-------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 1 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 1
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* stage: Unreviewed => Design decision needed


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:8>

Django

unread,
Dec 7, 2011, 3:11:57 PM12/7/11
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-
unicode data in the database to be the primary key referenced by relation
fields.
-------------------------------------+-------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 1 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 1
| UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by aaugustin):

#17214 is probably a duplicate.

--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:9>

Django

unread,
Apr 4, 2013, 6:50:00 PM4/4/13
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-

unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+------------------------------------

Reporter: nickname123 | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by jacob):

* stage: Design decision needed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:10>

Django

unread,
Jun 13, 2015, 3:35:06 PM6/13/15
to django-...@googlegroups.com
#17122: Admin widgets and forms do not support custom model fields that store non-

unicode data in the database to be the primary key referenced by relation
fields.
-----------------------------+------------------------------------
Reporter: nickname123 | Owner: nobody
Type: Bug | Status: closed
Component: Forms | Version: 1.3
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by claudep):

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


Comment:

Considering that `UUIDField` is now part of Django and that the admin
seems to work fine with it, I'm closing the ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/17122#comment:11>

Reply all
Reply to author
Forward
0 new messages