... 配列フィールドは入れ子にできます。 base_field として ArrayField のインスタンスを指定できます。たとえば: from django.contrib.postgres.fields import ArrayField from django.db import models class ChessBoard ( models . Model ): board = ArrayField ( ArrayF ... オプションの引数です。 指定された場合、配列は指定された最大サイズを持ちます。これはデータベースに渡されますが、現在のところ PostgreSQL はこの制限を強制しません。 注釈 ArrayField を入れ子にする際、 size パラメータを使用するかどうかに関わらず、PostgreSQ ... L では配列は長方形である必要があります。 from django.contrib.postgres.fields import ArrayField from django.db import models class Board ( models . Model ): pieces = ArrayField ( ArrayField ... ... 配列フィールドは入れ子にできます。 base_field として ArrayField のインスタンスを指定できます。たとえば: from django.contrib.postgres.fields import ArrayField from django.db import models class ChessBoard ( models . Model ): board = ArrayField ( ArrayF ... オプションの引数です。 指定された場合、配列は指定された最大サイズを持ちます。これはデータベースに渡されますが、現在のところ PostgreSQL はこの制限を強制しません。 注釈 ArrayField を入れ子にする際、 size パラメータを使用するかどうかに関わらず、PostgreSQ ... L では配列は長方形である必要があります。 from django.contrib.postgres.fields import ArrayField from django.db import models class Board ( models . Model ): pieces = ArrayField ( ArrayField ... ... kwargs {'question_text': "What's new?", 'pub_date': datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.UTC)} post_init ¶ django.db.models.signals. post_init ¶ pre_init と似ていますが、このイベントは __init__() メソッドが終了した時に送信 ... た今インスタンスが作成されたモデルクラス。 instance たった今作成されたモデルの実際のインスタンス。 注釈 instance._state は、 post_init シグナルを送信する前に設定されていないため、 _state 属性は常にそのデフォルト値を持ちます。例えば、 _state.db は None ... です。 警告 パフォーマンス上の理由から、 pre_init または post_init シグナルのレシーバでクエリを実行するべきではありません。なぜなら、クエリセットのイテレート中に返される各インスタンスに ... ... kwargs {'question_text': "What's new?", 'pub_date': datetime.datetime(2012, 2, 26, 13, 0, 0, 775217, tzinfo=datetime.UTC)} post_init ¶ django.db.models.signals. post_init ¶ pre_init と似ていますが、このイベントは __init__() メソッドが終了した時に送信 ... た今インスタンスが作成されたモデルクラス。 instance たった今作成されたモデルの実際のインスタンス。 注釈 instance._state は、 post_init シグナルを送信する前に設定されていないため、 _state 属性は常にそのデフォルト値を持ちます。例えば、 _state.db は None ... です。 警告 パフォーマンス上の理由から、 pre_init または post_init シグナルのレシーバでクエリを実行するべきではありません。なぜなら、クエリセットのイテレート中に返される各インスタンスに ... ... レポートからフィルタリングされる情報を制御するのに役立つ関数デコレータを提供しています。 sensitive_variables() と sensitive_post_parameters() です。 sensitive_variables ( * variables ) [ソース] ¶ コード内の関数(ビューまたは通常のコールバック)が機密情 ... @sensitive_variables ( "user" , "pw" , "cc" ) @some_decorator @another_decorator def process_info ( user ): ... sensitive_post_parameters ( * parameters ) [ソース] ¶ If one of your views receives an HttpRequest object with POST parameters susceptibl ... e information, you may prevent the values of those parameters from being included in the error reports using the sensitive_post_parameters decorator: from django.views.decorators.debug import sensitive_post_parameters @sensitive_post_parameters ( "pa ... ... レポートからフィルタリングされる情報を制御するのに役立つ関数デコレータを提供しています。 sensitive_variables() と sensitive_post_parameters() です。 sensitive_variables ( * variables ) [ソース] ¶ コード内の関数(ビューまたは通常のコールバック)が機密情 ... @sensitive_variables ( "user" , "pw" , "cc" ) @some_decorator @another_decorator def process_info ( user ): ... sensitive_post_parameters ( * parameters ) [ソース] ¶ If one of your views receives an HttpRequest object with POST parameters susceptibl ... e information, you may prevent the values of those parameters from being included in the error reports using the sensitive_post_parameters decorator: from django.views.decorators.debug import sensitive_post_parameters @sensitive_post_parameters ( "pa ... ... 要素を入れましょう。 polls/templates/polls/detail.html ¶ < form action = " {% url 'polls:vote' question.id %} " method = "post" > {% csrf_token %} < fieldset > < legend >< h1 > {{ question.question_text }} </ h1 ></ legend > {% if error_message %} < ... 問の選択肢のIDです。各ラジオボタンの name は "choice" です。つまり、投票者がラジオボタンの1つを選択し、フォームを送信すると、POSTデータ choice=# (#は選んだ選択肢のID)が送信されます。これは、HTMLフォームの基本的な概念です。 フォームの action を {% url ... 'polls:vote' question.id %} に設定し、 method="post" を指定しています。 ( method="get" ではなく) method="post" を使用することは非常に重要です。なぜなら、フォームの送信はサーバ ... ... 要素を入れましょう。 polls/templates/polls/detail.html ¶ < form action = " {% url 'polls:vote' question.id %} " method = "post" > {% csrf_token %} < fieldset > < legend >< h1 > {{ question.question_text }} </ h1 ></ legend > {% if error_message %} < ... 問の選択肢のIDです。各ラジオボタンの name は "choice" です。つまり、投票者がラジオボタンの1つを選択し、フォームを送信すると、POSTデータ choice=# (#は選んだ選択肢のID)が送信されます。これは、HTMLフォームの基本的な概念です。 フォームの action を {% url ... 'polls:vote' question.id %} に設定し、 method="post" を指定しています。 ( method="get" ではなく) method="post" を使用することは非常に重要です。なぜなら、フォームの送信はサーバ ... ... imit on passwords and will fail authentication with any submitted password of greater length. Corrected usage of sensitive_post_parameters() in django.contrib.auth 's admin ¶ The decoration of the add_view and user_change_password user admin views wi ... th sensitive_post_parameters() did not include method_decorator() (required since the views are methods) resulting in the decorator not bein ... g properly applied. This usage has been fixed and sensitive_post_parameters() will now throw an exception if it's improperly used. 目次 Django 1.4.8 リリースノート Denial-of-service via p ... ... ンスを生成します: >>> from myapp.models import Article >>> from myapp.forms import ArticleForm # Create a form instance from POST data. >>> f = ArticleForm ( request . POST ) # Save a new Article object from the form's data. >>> new_article = f . save ... () # Create a form to edit an existing Article, but use # POST data to populate the form. >>> a = Article . objects . get ( pk = 1 ) >>> f = ArticleForm ( request . POST , instance = a ... を手動で save した後に、多対多のフォームデータを保存するには save_m2m() を実行します。例えば: # Create a form instance with POST data. >>> f = AuthorForm ( request . POST ) # Create, but don't save the new author instance. >>> new_author = f . save ( ... 2026年10月08日