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
2f7a7842
Kaydet (Commit)
2f7a7842
authored
Haz 04, 2014
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22747 -- Add backwards compatibility tip for new behavior of formset.save(commit=False).
Thanks django at patjack.co.uk.
üst
45e04993
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
formsets.txt
docs/topics/forms/formsets.txt
+12
-0
No files found.
docs/topics/forms/formsets.txt
Dosyayı görüntüle @
2f7a7842
...
@@ -509,6 +509,18 @@ model instances for deleted forms will be deleted when you call
...
@@ -509,6 +509,18 @@ model instances for deleted forms will be deleted when you call
>>> for obj in formset.deleted_objects:
>>> for obj in formset.deleted_objects:
... obj.delete()
... obj.delete()
If you want to maintain backwards compatibility with Django 1.6 and earlier,
you can do something like this::
>>> try:
>>> # For Django 1.7+
>>> for obj in formset.deleted_objects:
>>> obj.delete()
>>> except AssertionError:
>>> # Django 1.6 and earlier already deletes the objects, trying to
>>> # delete them a second time raises an AssertionError.
>>> pass
On the other hand, if you are using a plain ``FormSet``, it's up to you to
On the other hand, if you are using a plain ``FormSet``, it's up to you to
handle ``formset.deleted_forms``, perhaps in your formset's ``save()`` method,
handle ``formset.deleted_forms``, perhaps in your formset's ``save()`` method,
as there's no general notion of what it means to delete a form.
as there's no general notion of what it means to delete a form.
...
...
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