DJANGOLEARN_IR Telegram 1106
جنگولرن
وات ایز F() expressions در جنگو 😁 جنگو در مورد تابع F توی داکیومنت میگه: An F() object represents the value of a model field, transformed value of a model field, or annotated column. It makes it possible to refer to model field values and perform database…
نکته ای از عثمان در مورد پست F

ی مورد دیگه که خود جنگو داره از F object استفاده میکنه زمانیه که شما سعی میکنی ی رکورد جدید توی تیبل ایجاد کنی که اگه همون موقع بدون کال کردن refresh_from_db بیای یکی از فیلدهای رکورد جدید رو تو ی کوئری یا ایجاد رکورد تو ی جدول دیگه استفاده کنی توی کوئری یا ترنزکشنت ORM میاد دقیقا به اسم همون فیلد ترجمه میکنه، مثال:

شما فکر کنید ی تیبل به اسم Stock دارید و ی تیبل دیگه به اسم StockLog
فیلدهای استاک:
quantity
quantity_allocated

فیلدهای استاک لاگ:
initial_quantity
final_quantity

حالا شما ی رکورد جدید تو تیبل استاک می سازید:
stock = Stock.objects.create(quantity=10, quantity_allocated=0)

و میای بعدش میگی:
StockLog.objects.create(initial_quantity=0, final_quantity=stock.quantity)

Orm -> insert into stocklog(initial_quantity, quantity) values(0, 10)

اینجا حتما باید حواست به رفرش قبل اساین باشه
5🤔41



tgoop.com/djangolearn_ir/1106
Create:
Last Update:

نکته ای از عثمان در مورد پست F

ی مورد دیگه که خود جنگو داره از F object استفاده میکنه زمانیه که شما سعی میکنی ی رکورد جدید توی تیبل ایجاد کنی که اگه همون موقع بدون کال کردن refresh_from_db بیای یکی از فیلدهای رکورد جدید رو تو ی کوئری یا ایجاد رکورد تو ی جدول دیگه استفاده کنی توی کوئری یا ترنزکشنت ORM میاد دقیقا به اسم همون فیلد ترجمه میکنه، مثال:

شما فکر کنید ی تیبل به اسم Stock دارید و ی تیبل دیگه به اسم StockLog
فیلدهای استاک:
quantity
quantity_allocated

فیلدهای استاک لاگ:
initial_quantity
final_quantity

حالا شما ی رکورد جدید تو تیبل استاک می سازید:
stock = Stock.objects.create(quantity=10, quantity_allocated=0)

و میای بعدش میگی:
StockLog.objects.create(initial_quantity=0, final_quantity=stock.quantity)

Orm -> insert into stocklog(initial_quantity, quantity) values(0, 10)

اینجا حتما باید حواست به رفرش قبل اساین باشه

BY جنگولرن


Share with your friend now:
tgoop.com/djangolearn_ir/1106

View MORE
Open in Telegram


Telegram News

Date: |

The court said the defendant had also incited people to commit public nuisance, with messages calling on them to take part in rallies and demonstrations including at Hong Kong International Airport, to block roads and to paralyse the public transportation system. Various forms of protest promoted on the messaging platform included general strikes, lunchtime protests and silent sit-ins. To view your bio, click the Menu icon and select “View channel info.” Activate up to 20 bots During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. Telegram Channels requirements & features
from us


Telegram جنگولرن
FROM American