Merge pull request #2284 from bagerard/remove_field_name_attribute_deprecated
Remove name param in Field constructor (replaced by db_field)
This commit is contained in:
commit
68be9fe979
@ -10,6 +10,7 @@ Development
|
|||||||
- Fixed a bug causing inaccurate query results, while combining ``__raw__`` and regular filters for the same field #2264
|
- Fixed a bug causing inaccurate query results, while combining ``__raw__`` and regular filters for the same field #2264
|
||||||
- Add support for the `elemMatch` projection operator in .fields() (e.g BlogPost.objects.fields(elemMatch__comments="test")) #2267
|
- Add support for the `elemMatch` projection operator in .fields() (e.g BlogPost.objects.fields(elemMatch__comments="test")) #2267
|
||||||
- DictField validate failed without default connection (bug introduced in 0.19.0) #2239
|
- DictField validate failed without default connection (bug introduced in 0.19.0) #2239
|
||||||
|
- Remove name parameter in Field constructor e.g `StringField(name="...")`, it was deprecated a while ago in favor of db_field
|
||||||
- Remove method queryset.slave_okay() that was deprecated a while ago and disappeared since pymongo3
|
- Remove method queryset.slave_okay() that was deprecated a while ago and disappeared since pymongo3
|
||||||
|
|
||||||
Changes in 0.19.1
|
Changes in 0.19.1
|
||||||
|
@ -36,7 +36,6 @@ class BaseField(object):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
db_field=None,
|
db_field=None,
|
||||||
name=None,
|
|
||||||
required=False,
|
required=False,
|
||||||
default=None,
|
default=None,
|
||||||
unique=False,
|
unique=False,
|
||||||
@ -51,7 +50,6 @@ class BaseField(object):
|
|||||||
"""
|
"""
|
||||||
:param db_field: The database field to store this field in
|
:param db_field: The database field to store this field in
|
||||||
(defaults to the name of the field)
|
(defaults to the name of the field)
|
||||||
:param name: Deprecated - use db_field
|
|
||||||
:param required: If the field is required. Whether it has to have a
|
:param required: If the field is required. Whether it has to have a
|
||||||
value or not. Defaults to False.
|
value or not. Defaults to False.
|
||||||
:param default: (optional) The default value for this field if no value
|
:param default: (optional) The default value for this field if no value
|
||||||
@ -75,11 +73,8 @@ class BaseField(object):
|
|||||||
existing attributes. Common metadata includes `verbose_name` and
|
existing attributes. Common metadata includes `verbose_name` and
|
||||||
`help_text`.
|
`help_text`.
|
||||||
"""
|
"""
|
||||||
self.db_field = (db_field or name) if not primary_key else "_id"
|
self.db_field = db_field if not primary_key else "_id"
|
||||||
|
|
||||||
if name:
|
|
||||||
msg = 'Field\'s "name" attribute deprecated in favour of "db_field"'
|
|
||||||
warnings.warn(msg, DeprecationWarning)
|
|
||||||
self.required = required or primary_key
|
self.required = required or primary_key
|
||||||
self.default = default
|
self.default = default
|
||||||
self.unique = bool(unique or unique_with)
|
self.unique = bool(unique or unique_with)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user