Remove Field(name='...') which was deprecated when db_field was introduced a while ago
This commit is contained in:
		| @@ -10,6 +10,7 @@ Development | ||||
| - 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 | ||||
| - 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 | ||||
|  | ||||
| Changes in 0.19.1 | ||||
| ================= | ||||
|   | ||||
| @@ -36,7 +36,6 @@ class BaseField(object): | ||||
|     def __init__( | ||||
|         self, | ||||
|         db_field=None, | ||||
|         name=None, | ||||
|         required=False, | ||||
|         default=None, | ||||
|         unique=False, | ||||
| @@ -51,7 +50,6 @@ class BaseField(object): | ||||
|         """ | ||||
|         :param db_field: The database field to store this field in | ||||
|             (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 | ||||
|             value or not. Defaults to False. | ||||
|         :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 | ||||
|             `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.default = default | ||||
|         self.unique = bool(unique or unique_with) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user