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
e9ea49d2
Kaydet (Commit)
e9ea49d2
authored
Agu 06, 2018
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Consolidated docs about handling a ForeignKey in custom user model manager.
üst
03e918d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
customizing.txt
docs/topics/auth/customizing.txt
+8
-14
No files found.
docs/topics/auth/customizing.txt
Dosyayı görüntüle @
e9ea49d2
...
...
@@ -560,13 +560,6 @@ password resets. You must then provide some key implementation details:
...
USERNAME_FIELD = 'identifier'
:attr:`USERNAME_FIELD` now supports
:class:`~django.db.models.ForeignKey`\s. Since there is no way to pass
model instances during the :djadmin:`createsuperuser` prompt, expect the
user to enter the value of :attr:`~django.db.models.ForeignKey.to_field`
value (the :attr:`~django.db.models.Field.primary_key` by default) of an
existing instance.
.. attribute:: EMAIL_FIELD
A string describing the name of the email field on the ``User`` model.
...
...
@@ -600,13 +593,6 @@ password resets. You must then provide some key implementation details:
model, but should *not* contain the ``USERNAME_FIELD`` or
``password`` as these fields will always be prompted for.
:attr:`REQUIRED_FIELDS` now supports
:class:`~django.db.models.ForeignKey`\s. Since there is no way to pass
model instances during the :djadmin:`createsuperuser` prompt, expect the
user to enter the value of :attr:`~django.db.models.ForeignKey.to_field`
value (the :attr:`~django.db.models.Field.primary_key` by default) of an
existing instance.
.. attribute:: is_active
A boolean attribute that indicates whether the user is considered
...
...
@@ -729,6 +715,9 @@ The following attributes and methods are available on any subclass of
:meth:`.BaseUserManager.normalize_email`. If you override this method,
be sure to call ``super()`` to retain the normalization.
Writing a manager for a custom user model
-----------------------------------------
You should also define a custom manager for your user model. If your user model
defines ``username``, ``email``, ``is_staff``, ``is_active``, ``is_superuser``,
``last_login``, and ``date_joined`` fields the same as Django's default user,
...
...
@@ -764,6 +753,11 @@ providing two additional methods:
Unlike ``create_user()``, ``create_superuser()`` *must* require the
caller to provide a password.
For a :class:`~.ForeignKey` in :attr:`.USERNAME_FIELD` or
:attr:`.REQUIRED_FIELDS`, these methods receive the value of the
:attr:`~.ForeignKey.to_field` (the :attr:`~django.db.models.Field.primary_key`
by default) of an existing instance.
:class:`~django.contrib.auth.models.BaseUserManager` provides the following
utility methods:
...
...
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