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
0c916255
Kaydet (Commit)
0c916255
authored
Nis 22, 2019
tarafından
Luke Plant
Kaydeden (comit)
Mariusz Felisiak
Nis 24, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Changed tuple Mate.unique_together/permissions to lists in docs.
üst
607ff4ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
13 deletions
+13
-13
options.txt
docs/ref/models/options.txt
+6
-6
customizing.txt
docs/topics/auth/customizing.txt
+2
-2
default.txt
docs/topics/auth/default.txt
+2
-2
serialization.txt
docs/topics/serialization.txt
+3
-3
No files found.
docs/ref/models/options.txt
Dosyayı görüntüle @
0c916255
...
...
@@ -309,7 +309,7 @@ Django quotes column and table names behind the scenes.
Add, change, delete, and view permissions are automatically created for each
model. This example specifies an extra permission, ``can_deliver_pizzas``::
permissions =
(("can_deliver_pizzas", "Can deliver pizzas"),)
permissions =
[('can_deliver_pizzas', 'Can deliver pizzas')]
This is a list or tuple of 2-tuples in the format ``(permission_code,
human_readable_permission_name)``.
...
...
@@ -408,17 +408,17 @@ Django quotes column and table names behind the scenes.
Sets of field names that, taken together, must be unique::
unique_together =
(("driver", "restaurant"),)
unique_together =
[['driver', 'restaurant']]
This is a
tuple of tuple
s that must be unique when considered together.
This is a
list of list
s that must be unique when considered together.
It's used in the Django admin and is enforced at the database level (i.e., the
appropriate ``UNIQUE`` statements are included in the ``CREATE TABLE``
statement).
For convenience,
unique_together can be a single tuple when dealing with a single
set of fields::
For convenience,
``unique_together`` can be a single list when dealing with
a single
set of fields::
unique_together =
("driver", "restaurant")
unique_together =
['driver', 'restaurant']
A :class:`~django.db.models.ManyToManyField` cannot be included in
unique_together. (It's not clear what that would even mean!) If you
...
...
docs/topics/auth/customizing.txt
Dosyayı görüntüle @
0c916255
...
...
@@ -277,10 +277,10 @@ can or cannot do with ``Task`` instances, specific to your application::
class Task(models.Model):
...
class Meta:
permissions =
(
permissions =
[
("change_task_status", "Can change the status of tasks"),
("close_task", "Can remove a task by setting its status as closed"),
)
]
The only thing this does is create those extra permissions when you run
:djadmin:`manage.py migrate <migrate>` (the function that creates permissions
...
...
docs/topics/auth/default.txt
Dosyayı görüntüle @
0c916255
...
...
@@ -328,12 +328,12 @@ inherit the permissions of the concrete model they subclass::
class Person(models.Model):
class Meta:
permissions =
(('can_eat_pizzas', 'Can eat pizzas'),)
permissions =
[('can_eat_pizzas', 'Can eat pizzas')]
class Student(Person):
class Meta:
proxy = True
permissions =
(('can_deliver_pizzas', 'Can deliver pizzas'),)
permissions =
[('can_deliver_pizzas', 'Can deliver pizzas')]
>>> # Fetch the content type for the proxy model.
>>> content_type = ContentType.objects.get_for_model(Student, for_concrete_model=False)
...
...
docs/topics/serialization.txt
Dosyayı görüntüle @
0c916255
...
...
@@ -367,7 +367,7 @@ Consider the following two models::
birthdate = models.DateField()
class Meta:
unique_together =
(('first_name', 'last_name'),)
unique_together =
[['first_name', 'last_name']]
class Book(models.Model):
name = models.CharField(max_length=100)
...
...
@@ -411,7 +411,7 @@ name::
objects = PersonManager()
class Meta:
unique_together =
(('first_name', 'last_name'),)
unique_together =
[['first_name', 'last_name']]
Now books can use that natural key to refer to ``Person`` objects::
...
...
@@ -459,7 +459,7 @@ Firstly, you need to add another method -- this time to the model itself::
objects = PersonManager()
class Meta:
unique_together =
(('first_name', 'last_name'),)
unique_together =
[['first_name', 'last_name']]
def natural_key(self):
return (self.first_name, self.last_name)
...
...
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