kopia lustrzana https://github.com/wagtail/wagtail
ChooserBlock should use pk instead of id
rodzic
690255c2ee
commit
5270c14444
|
@ -10,6 +10,7 @@ Changelog
|
|||
* Fix: Deleting a page content type now preserves existing pages as basic Page instances, to prevent tree corruption
|
||||
* Fix: The `Page.path` field is now explicitly given the "C" collation on PostgreSQL to prevent tree ordering issues when using a database created with the Slovak locale
|
||||
* Fix: Wagtail's compiled static assets are now put into the correct directory on Windows (Aarni Koskela)
|
||||
* Fix: `ChooserBlock` now correctly handles models with primary keys other than `id` (alexpilot11)
|
||||
|
||||
1.3.1 (05.01.2016)
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -96,6 +96,7 @@ Contributors
|
|||
* benjaoming
|
||||
* Alexander Bogushov
|
||||
* Aarni Koskela
|
||||
* alexpilot11
|
||||
|
||||
|
||||
Translators
|
||||
|
|
|
@ -27,6 +27,7 @@ Bug fixes
|
|||
* Deleting a page content type now preserves existing pages as basic Page instances, to prevent tree corruption
|
||||
* The ``Page.path`` field is now explicitly given the "C" collation on PostgreSQL to prevent tree ordering issues when using a database created with the Slovak locale
|
||||
* Wagtail's compiled static assets are now put into the correct directory on Windows (Aarni Koskela)
|
||||
* ``ChooserBlock`` now correctly handles models with primary keys other than ``id`` (alexpilot11)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
|
|
|
@ -353,11 +353,11 @@ class ChooserBlock(FieldBlock):
|
|||
return None
|
||||
|
||||
def get_prep_value(self, value):
|
||||
# the native value (a model instance or None) should serialise to an ID or None
|
||||
# the native value (a model instance or None) should serialise to a PK or None
|
||||
if value is None:
|
||||
return None
|
||||
else:
|
||||
return value.id
|
||||
return value.pk
|
||||
|
||||
def value_from_form(self, value):
|
||||
# ModelChoiceField sometimes returns an ID, and sometimes an instance; we want the instance
|
||||
|
|
Ładowanie…
Reference in New Issue