Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
4ccdf6e5
Kaydet (Commit)
4ccdf6e5
authored
Ara 24, 2014
tarafından
Helen Sherwood-Taylor
Kaydeden (comit)
Tim Graham
Ara 24, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24041 -- Documented effect of changing a model instance's primary key.
üst
3daa9d60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
fields.txt
docs/ref/models/fields.txt
+7
-2
models.txt
docs/topics/db/models.txt
+17
-0
No files found.
docs/ref/models/fields.txt
Dosyayı görüntüle @
4ccdf6e5
...
...
@@ -278,8 +278,13 @@ don't need to set ``primary_key=True`` on any of your fields unless you want to
override the default primary-key behavior. For more, see
:ref:`automatic-primary-key-fields`.
``primary_key=True`` implies :attr:`null=False <Field.null>` and :attr:`unique=True <Field.unique>`.
Only one primary key is allowed on an object.
``primary_key=True`` implies :attr:`null=False <Field.null>` and
:attr:`unique=True <Field.unique>`. Only one primary key is allowed on an
object.
The primary key field is read-only. If you change the value of the primary
key on an existing object and then save it, a new object will be created
alongside the old one.
``unique``
----------
...
...
docs/topics/db/models.txt
Dosyayı görüntüle @
4ccdf6e5
...
...
@@ -213,6 +213,23 @@ ones:
unless you want to override the default primary-key behavior. For more,
see :ref:`automatic-primary-key-fields`.
The primary key field is read-only. If you change the value of the primary
key on an existing object and then save it, a new object will be created
alongside the old one. For example::
from django.db import models
class Fruit(models.Model):
name = models.CharField(max_length=100, primary_key=True)
.. code-block:: pycon
>>> fruit = Fruit.objects.create(name='Apple')
>>> fruit.name = 'Pear'
>>> fruit.save()
>>> Fruit.objects.values_list('name', flat=True)
['Apple', 'Pear']
:attr:`~Field.unique`
If ``True``, this field must be unique throughout the table.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment