#19539: Writing custom model fields: The __metaclass__ attribute is no longer
supported in Python 3
-------------------------------+-------------------------
Reporter: astorije@… | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 1.5-alpha-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------
As Django 1.5 introduces the support of Python 3, I think the
documentation of "Writing custom model fields" should warn developers
that:
{{{
#!python
class MyCustomField(models.Field):
__metaclass__ = models.SubfieldBase
}}}
is no longer supported and that they should use:
{{{
#!python
class MyCustomField(models.Field, metaclass=models.SubfieldBase):
...
}}}
instead.
Writing in the first (old) fashion results in no errors or warnings
whatsoever. The to_python() method is just not called as it should be...
--
Ticket URL: <https://code.djangoproject.com/ticket/19539>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.