mirror of
				https://github.com/django/django.git
				synced 2025-11-04 05:35:37 +00:00 
			
		
		
		
	Documentation - Noted that OneToOneField doesn't respect unique.
Added OneToOneField to the list of model fields for which the unique argument isn't valid. (OneToOneFields are inherently unique, and if the user supplies a value for unique it is ignored / overwritten.)
This commit is contained in:
		
							parent
							
								
									c5fbd16362
								
							
						
					
					
						commit
						7775ced938
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -281,8 +281,8 @@ you try to save a model with a duplicate value in a :attr:`~Field.unique`
 | 
				
			||||||
field, a :exc:`django.db.IntegrityError` will be raised by the model's
 | 
					field, a :exc:`django.db.IntegrityError` will be raised by the model's
 | 
				
			||||||
:meth:`~django.db.models.Model.save` method.
 | 
					:meth:`~django.db.models.Model.save` method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This option is valid on all field types except :class:`ManyToManyField` and
 | 
					This option is valid on all field types except :class:`ManyToManyField`,
 | 
				
			||||||
:class:`FileField`.
 | 
					:class:`OneToOneField`, and :class:`FileField`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Note that when ``unique`` is ``True``, you don't need to specify
 | 
					Note that when ``unique`` is ``True``, you don't need to specify
 | 
				
			||||||
:attr:`~Field.db_index`, because ``unique`` implies the creation of an index.
 | 
					:attr:`~Field.db_index`, because ``unique`` implies the creation of an index.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue