per page, with , order by , clip by
Results of 1 - 10 of about 103 for instance (0.007 sec.)
モデルインスタンスリファレンス 12999
モデルインスタンスリファレンス このドキュメントでは、 Model API の詳細を説明しています。 モデル と データベースクエリ ガイドにある説明を前提としていますので、このドキュメントを読む前にこの 2 つを読んでおいた方がよいでしょう。 このリファレン ... __init__ method. If you do so, however, take care not to change the calling signature as any change may prevent the model instance from being saved. Additionally, referring to model fields within __init__ may potentially result in infinite recursion err ... fferent type (for example, a string assigned to a UUIDField ) may be converted when save() executes a query, the in-memory instance will keep the original value until it is reloaded . モデルの読み込みをカスタマイズする classmethod Model. from_db ( db , f ... all of the model's fields are present, then values are guaranteed to be in the order __init__() expects them. That is, the instance can be created by cls(*values) . If any fields are deferred, they won't appear in field_names . In that case, assign a val ...
https://man.mtool.work/django/6.1/ref/models/instances.html
モデルからフォームを作成する 12070
モデルからフォームを作成する ModelForm class ModelForm [ソース] データベース中心のアプリケーションを作成している場合、Django モデルに密接にマップするフォームを使うことになるでしょう。例えば、 BlogComment モデルを持っていて、閲覧者がコメント ... # Creating a form to change an existing article. >>> article = Article . objects . get ( pk = 1 ) >>> form = ArticleForm ( instance = article ) フィールドの型 生成された Form クラスは、指定された全てのモデルフィールドに対して、 fields 属性で指定された順番 ... ドをオーバーライドして、バリデーションの動作を追加できます。 モデルのオブジェクトに付属したモデルフォームのインスタンスは、 instance 属性を持ち、メソッドが特定のモデルのインスタンスにアクセスできるようにします。 警告 The ModelForm.clean() method sets flag ... は、フォームに結びつけられたデータからデータベースオブジェクトを生成して保存します。 ModelForm のサブクラスはキーワード引数 instance として既存のモデルインスタンスを受け取ることができます; これが指定されると、 save() はそのインスタンスを更新するようになり ...
https://man.mtool.work/django/6.1/topics/forms/modelforms.html
メールを送信する 10327
メールを送信する Django provides wrappers for Python's email and smtplib modules to simplify composing and sending email. Django's email framework also supports swapping in different delivery mechanisms: you can direct email to the console ... render_to_string ( "templates/emails/my_email.html" , context = { "my_variable" : 42 }, ) # Then, create a multipart email instance. msg = EmailMultiAlternatives ( subject = "Subject here" , body = text_content , from_email = "from@example.com" , to = [ ... .com" ], headers = { "List-Unsubscribe" : "<mailto:unsub@example.com>" }, ) # Lastly, attach the HTML content to the email instance and send. msg . attach_alternative ( html_content , "text/html" ) msg . send () Configuring email New Django projects are ... se advanced features, such as BCC'ed recipients, file attachments, or multi-part email, you'll need to create EmailMessage instances directly. 注釈 This is a design feature. send_mail() and related functions were originally the only interface Django prov ...
https://man.mtool.work/django/6.1/topics/email.html
Django 1.8 リリースノート 9656
Django 1.8 リリースノート April 1, 2015 Django 1.8 へようこそ! このリリースノートでは、 バージョン 1.8 の新機能 と、Django 1.7 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。 非推奨サイクルが終了した機能 ... as been cleaned and validated, the UploadedFile object will have an additional image attribute containing the Pillow Image instance used to check if the file was a valid image. It will also update UploadedFile.content_type with the image's content type a ... he database, which can lead to somewhat complex queries involving nested REPLACE function calls. You can now refresh model instances by using Model.refresh_from_db() . You can now get the set of deferred fields for a model using Model.get_deferred_fields ... a Uniform Resource Identifier (URI) properly. HttpResponse now implements a few additional methods like getvalue() so that instances can be used as stream objects. The new HttpResponse.setdefault() method allows setting a header unless it has already bee ...
https://man.mtool.work/django/6.1/releases/1.8.html
Fetch modes 9527
Fetch modes New in Django 6.1. When accessing model fields that were not loaded as part of the original query, Django will fetch that field's data from the database. You can customize the behavior of this fetching with a fetch mode , making ... it more efficient or even blocking it. Use QuerySet.fetch_mode() to set the fetch mode for model instances fetched by a QuerySet : from django.db import models books = Book . objects . fetch_mode ( models . FETCH_PEERS ) Fetch m ... d with QuerySet.defer() or QuerySet.only() ジェネリックリレーション(汎用リレーション) Django copies the fetch mode of an instance to any related objects it fetches, so the mode applies to a whole tree of relationships, not just the top-level model in t ... dels . CASCADE ) ... …and this loop: for book in books : print ( book . author . name ) …where books is a QuerySet of Book instances using some fetch mode. FETCH_ONE Fetches the missing field for the current instance only. This is the default mode. Using ...
https://man.mtool.work/django/6.1/topics/db/fetch-modes.html
Django 1.7 リリースノート 8855
Django 1.7 リリースノート September 2, 2014 Django 1.7 へようこそ! このリリースノートでは、 バージョン 1.7 の新機能 と、Django 1.6 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。 非推奨サイクルが終了した ... on a custom Manager class. The problem with this approach was that after the first method call, you'd get back a QuerySet instance and couldn't call additional custom manager methods. Though not documented, it was common to work around this issue by cre ... thod allows adding errors to specific form fields from anywhere without having to worry about the details such as creating instances of django.forms.utils.ErrorList or dealing with Form.cleaned_data . This new API replaces manipulating Form._errors which ... soon as the errors were added to Form.errors . Form.errors and django.forms.utils.ErrorList now store the ValidationError instances so these metadata can be retrieved at any time through the new Form.errors.as_data method. The retrieved ValidationError ...
https://man.mtool.work/django/6.1/releases/1.7.html
複数のデータベース 8713
複数のデータベース ここでは、Djangoがサポートする複数データベースの扱いについて説明します。残りのDjangoのドキュメントの大部分は、あなたが一つのデータベース扱うことを前提としています。複数のデータベースを使いたいなら、いくつかの追加ステップを ... トをどのデータベースが受け取るべきかを決定するために使うことができます。 At present, the only hint that will be provided is instance , an object instance that is related to the read or write operation that is underway. This might be the instance that is b ... eing saved, or it might be an instance that is being added in a many-to-many relation. In some cases, no instance hint will be provided at all. The router checks ... for the existence of an instance hint, and determines if that hint should be used to alter routing behavior. If an instance hint is present, the database f ...
https://man.mtool.work/django/6.1/topics/db/multi-db.html
シグナル 8584
シグナル Djangoが送信する全てのシグナルのリストです。全ての組み込みシグナルは send() メソッドを使用して送信されます。 参考 シグナルの登録方法と受信方法に関する情報については、 シグナルディスパッチャ のドキュメントを参照してください。 認証フ ... ます。 このシグナルとともに送信される引数は以下の通りです: sender 上記の通り: たった今インスタンスが作成されたモデルクラス。 instance たった今作成されたモデルの実際のインスタンス。 注釈 instance._state は、 post_init シグナルを送信する前に設定されていないた ... 、モデルの save() メソッドの始まりに送信されます。 このシグナルとともに送信される引数は以下の通りです: sender モデルクラス。 instance 保存される実際のインスタンス。 raw 真偽値です。モデルがそのままの形 (例えば フィクスチャ を読み込む時) で保存されている場合 ... ていますが、 save() メソッドの最後に送信されます。 このシグナルとともに送信される引数は以下の通りです: sender モデルクラス。 instance 保存される実際のインスタンス。 created ブール値。レコードが作成された場合に True を返す。 raw 真偽値です。モデルがそのまま ...
https://man.mtool.work/django/6.1/ref/signals.html
Django 1.2 リリースノート 7642
Django 1.2 リリースノート 2010 年 5 月 17 日 Django 1.2 へようこそ! Nearly a year in the making, Django 1.2 packs an impressive list of new features and lots of bug fixes. These release notes cover the new features, as well as important cha ... introduces several large, important new features, including: Support for multiple database connections in a single Django instance. Model validation inspired by Django's form validation. Vastly improved protection against Cross-Site Request Forgery (CSR ... al objects can be saved to a specific database by providing a using argument when you call save() . Model validation Model instances now have support for validating their own data , and both model and form fields now accept configurable lists of validato ... capsulated validation behavior. Note, however, that validation must still be performed explicitly. Simply invoking a model instance's save() method will not perform any validation of the instance's data. Improved CSRF protection Django now has much impro ...
https://man.mtool.work/django/6.1/releases/1.2.html
Django's Tasks framework 7642
Django's Tasks framework New in Django 6.0: For older Django versions, the django-tasks backport is available. For a web application, there's often more than just turning HTTP requests into HTTP responses. For some functionality, it may be ... = subject , message = message , from_email = None , recipient_list = emails ) The return value of the decorator is a Task instance. Task attributes can be customized via the @task decorator arguments: from django.core.mail import send_mail from django.t ... xt about how it was enqueued, and how it is being executed. This can be accessed by taking a context argument, which is an instance of TaskContext . To receive the Task context as an argument to your Task function, pass takes_context when defining it: im ... cessary to modify certain parameters of the Task. For example, to give it a higher priority than it would normally. A Task instance cannot be modified directly. Instead, a modified instance can be created with the using() method, leaving the original as- ...
https://man.mtool.work/django/6.1/topics/tasks.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT