@djangoproject · Post #427 · 30.08.2017 г., 03:37
What happens when you #save within #django? 1- Emit a pre-save signal. 2- Preprocess the data. 3- Prepare the data for the database. 4- Insert the data into the database. 5- Emit a post-save signal.
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #418 · 9 мар.
Оператор pipe позволяет писать более компактный код, реализуя логику объединения данных (Union). Важно помнить, что его поведение зависит от контекста. Побитовые операции (логическое OR) result = 5 | 3 # 5 (0101) | 3 (0011) = 7 (0111) Самое главное - не путать с оператором or, это другое! Объединение множеств set_a = {1, 2, 3} set_b = {3, 4, 5} set_c = set_a | set_b # {1, 2, 3, 4, 5} set_c |= {5, 6} # {1, 2, 3, 4, 5, 6} Слияние словарей dict_1 = {"a": 1, "b": 2} dict_2 = {"b": 3, "c": 4} merged = dict_1 | dict_2 # {'a': 1, 'b': 3, 'c': 4} merged |= {"d": 5} # {'a': 1, 'b': 3, 'c': 4, 'd': 5} Аннотации типов, заменяет Union def process_data(value: int | str) -> None: print(value) Допустимо использовать в isinstance или issubclass isinstance(3, int | float) # True Паттерн-матчинг status_code = 404 match status_code: case 200 | 201 | 204: print("OK") case 400 | 404 | 500: print("ERROR") Для использования в своих классах требуется переопределить метод __or__ Так же нашел библиотеку pipe которая добавляет еще много возможностей. Рекомендую ознакомиться ;) #basic
Hashtags
Пребарај: #save
@djangoproject · Post #427 · 30.08.2017 г., 03:37
What happens when you #save within #django? 1- Emit a pre-save signal. 2- Preprocess the data. 3- Prepare the data for the database. 4- Insert the data into the database. 5- Emit a post-save signal.
@graphmessenger · Post #438 · 15.05.2024 г., 09:15
🎞Save Animated Stickers As GIF ❤️Graph Messenger 11.9.0 🗓Added from: May 15, 2024 #features#sticker#save#gif @GraphMessenger @GraphMessengerTips
@djangoproject · Post #428 · 30.08.2017 г., 03:40
How #Django knows to #UPDATE vs. #INSERT when you call #save (), #Django follows this algorithm: If the object’s primary key attribute is set to a value that evaluates to True (i.e., a value other than None or the empty string), Django executes an UPDATE. If the object’s primary key attribute is not set or if the UPDATE didn’t update anything, Django executes an INSERT.
@testflightynoti · Post #37772 · 07.05.2026 г., 08:29
#AllFaves#Save#amp#Organize Join the AllFaves: Save & Organize beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/q4kYGP5g Shared by Dimitri
@meddahstories · Post #1773 · 22.01.2024 г., 15:28
Я сегодня нагло злоупотребляю пространством своего канала, хвастаясь новинками, но про этот тайтл я просто не могу молчать, ибо рисовка – любовь с первого взгляда и до последнего вздоха. Наконец-то до меня доехал первый том маньхуа "Дикая песнь" (Сэйв, 2020). Сбылась мечта идиота #China#manhua#NaganoHymns#ДикаяПеснь#Save
@testflightynoti · Post #37587 · 06.05.2026 г., 17:36
#Target#Shop#Style#Save Join the Target: Shop. Style. Save. beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/qcx8yK1s Shared by Dimitri
@botsgram_cu · Post #3971 · 02.06.2021 г., 16:34
@NephoBot Qué puede hacer este bot? Este es un bot administrador de archivos Idioma: Inglés (visto en @BotsGram_cu) #files, #media, #music, #picture, #manager, #file, #collection, #save, #photo, #tags, #video, #access, #search