per page, with , order by , clip by
Results of 1 - 10 of about 40 for choices (0.013 sec.)
モデルフィールドリファレンス 13823
モデルフィールドリファレンス このドキュメントには、Django が提供するフィールドオプション field options とフィールド型 field types を含む、 Field のすべての API リファレンスが記載されています。 注釈 フィールドは django.db.models.fields に定義 ... ue は null=False のフィールドでも使用できますが、この場合、 clean() を実装し、欠損値をプログラムで補完する必要があります。 choices Field. choices [ソース] このフィールドの選択肢として使用するための、以下で説明する形式のマッピングまたはイテラブルです。ch ... マッピングが指定された場合、キー要素はモデルに設定される実際の値で、2番目の要素は人間が読める名前です。例えば YEAR_IN_SCHOOL_CHOICES = { "FR" : "Freshman" , "SO" : "Sophomore" , "JR" : "Junior" , "SR" : "Senior" , "GR" : "Graduate" , } また、 sequence とし ... B2), ...] )。各タプルの最初の要素はモデルに設定される実際の値で、2番目の要素は人間が読める名前です。例えば YEAR_IN_SCHOOL_CHOICES = [ ( "FR" , "Freshman" ), ( "SO" , "Sophomore" ), ( "JR" , "Junior" ), ( "SR" , "Senior" ), ( "GR" , "Graduate" ), ] また ...
https://man.mtool.work/django/6.1/ref/models/fields.html
Django 5.0 リリースノート 13417
Django 5.0 リリースノート 2023年12月4日 Django 5.0 へようこそ! このリリースノートでは、 バージョン 5.0 の新機能 と、Django 4.2 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。また、 一部の機能を非推奨 とし ... , output_field = models . BigIntegerField (), db_persist = True , ) フィールドの選択肢を宣言する際のオプションが増加 Field.choices (モデルフィールド用) と ChoiceField.choices (フォームフィールド用) により、値を宣言する際の柔軟性が向上しました。以前のバー ... ジョンの Django では、 choices は 2 タプルのリストか、 列挙型 のサブクラスである必要がありましたが、後者の場合、 .choices 属性にアクセスして、期待される形 ... 式で値を提供する必要がありました: from django.db import models Medal = models . TextChoices ( "Medal" , "GOLD SILVER BRONZE" ) SPORT_CHOICES = [ ( "Martial Arts" , [( "judo" , "Judo" ), ( "karate" , "Karate" )]), ( ...
https://man.mtool.work/django/6.1/releases/5.0.html
フォーム フィールド 9735
フォーム フィールド class Field [ソース] Form クラスを作成時の一番重要な部分は、form のフィールド (field) の定義です。各フィールドにはカスタムの検証ロジックがあり、他にいくつかのフックもあります。 Field. clean ( value ) [ソース] Field クラス ... エラーメッセージには %(value)s が含まれていることがあり、選択された選択肢に置き換えられます。 1つの追加引数を受け取ります: choices [ソース] このフィールドの選択肢として使用する2値タプルの iterable 、 列挙型 、またはそのようなイテラブルを返す呼び出し可能 ... オブジェクトのいずれか。この引数は、モデルフィールドの choices 引数と同じ形式を受け入れます。詳細については、 モデルフィールドのリファレンスドキュメント を参照してください。引数が呼び出 ... ecified location should be included. Either this or allow_files must be True . FilePathField has the following method: set_choices () [ソース] New in Django 6.1. Scans the directory at path and refreshes the field's choices. This is called automatically ...
https://man.mtool.work/django/6.1/ref/forms/fields.html
ウィジェット 9595
ウィジェット ウィジェットは、Django が HTML の input 要素の表現方法です。ウィジェットは、HTML のレンダリングをコントロールして、ウィジェットに合致する GET/POST ディクショナリからデータを取り出します。 Built-in widgets によって作られる HTML ... 際にセットできます。以下の例では、 SelectDateWidget に対して years 属性がセットされます: from django import forms BIRTH_YEAR_CHOICES = [ "1980" , "1981" , "1982" ] FAVORITE_COLORS_CHOICES = { "blue" : "Blue" , "green" : "Green" , "black" : "Black" , } cla ... ss SimpleForm ( forms . Form ): birth_year = forms . DateField ( widget = forms . SelectDateWidget ( years = BIRTH_YEAR_CHOICES ) ) favorite_colors = forms . MultipleChoiceField ( required = False , widget = forms . CheckboxSelectMultiple , choices = ... FAVORITE_COLORS_CHOICES , ) 使用可能なウィジェットとそれぞれの引数の詳細については、 ビルトインのウィジェット を参照してください。 ウィジェットのイ ...
https://man.mtool.work/django/6.1/ref/forms/widgets.html
Django 6.1 release notes 9189
Django 6.1 release notes August 5, 2026 Welcome to Django 6.1! These release notes cover the new features , as well as some backwards incompatible changes you'll want to be aware of when upgrading from Django 6.0 or earlier. We've begun the ... ng to the admin index page. The admin's FilteredSelectMultiple widget now uses <optgroup> s to preserve named groups (e.g. choices=[("Group", [("1", "Item")]), ...] ). When ModelAdmin.list_select_related is False (the default), the change list now selec ... CE_LABEL defines a more accessible and translatable default label for the blank choice in forms, which is appended to most choices lists. The transitional setting USE_BLANK_CHOICE_DASH allows you to revert back to the old default label. FilePathField no ... w provides a set_choices() method to scan the directory at path and refresh the field's choices. This allows per-request refreshing when called in ...
https://man.mtool.work/django/6.1/releases/6.1.html
はじめての Django アプリ作成、その 2 8518
はじめての Django アプリ作成、その 2 このチュートリアルは チュートリアルその 1 の続きです。ここでは、データベースをセットアップして、最初のモデルを作成し、そして Django が自動的に生成してくれる管理サイトについて、簡単なイントロダクションをし ... worked. >>> q = Question . objects . get ( pk = 1 ) >>> q . was_published_recently () True # Give the Question a couple of Choices. The create call constructs a new # Choice object, does the INSERT statement, adds the choice to the set # of available ch ... on (e.g. a question's choice) which can be accessed via the API. >>> q = Question . objects . get ( pk = 1 ) # Display any choices from the related object set -- none so far. >>> q . choice_set . all () <QuerySet []> # Create three choices. >>> q . choi ... e double underscores to separate relationships. # This works as many levels deep as you want; there's no limit. # Find all Choices for any question whose pub_date is in this year # (reusing the 'current_year' variable we created above). >>> Choice . obj ...
https://man.mtool.work/django/6.1/intro/tutorial02.html
モデルからフォームを作成する 8518
モデルからフォームを作成する ModelForm class ModelForm [ソース] データベース中心のアプリケーションを作成している場合、Django モデルに密接にマップするフォームを使うことになるでしょう。例えば、 BlogComment モデルを持っていて、閲覧者がコメント ... たものがセットされます。 フォームフィールドの help_text はモデルフィールドの help_text がセットされます。 モデルフィールドに choices が設定されている場合、フォームフィールドの widget は Select にセットされ、選択肢にはモデルフィールドの choices が使われます ... な具体例 以下のような一連のモデルを考えていきましょう: from django.db import models from django.forms import ModelForm TITLE_CHOICES = { "MR" : "Mr." , "MRS" : "Mrs." , "MS" : "Ms." , } class Author ( models . Model ): name = models . CharField ( max_leng ... th = 100 ) title = models . CharField ( max_length = 3 , choices = TITLE_CHOICES ) birth_date = models . DateField ( blank = True , null = True ) def __str__ ( self ): return self . name ...
https://man.mtool.work/django/6.1/topics/forms/modelforms.html
Django 2.2.5 リリースノート 8378
Django 2.2.5 リリースノート September 2, 2019 Django 2.2.5 fixes several bugs in 2.2.4. バグ修正 Relaxed the system check added in Django 2.2 for models to reallow use of the same db_table by multiple models when database routers are instal ... StoreField when using on expressions with params ( #30672 ). Fixed a regression in Django 2.2 where ModelAdmin.list_filter choices to foreign objects don't respect a model's Meta.ordering ( #30449 ). ...
https://man.mtool.work/django/6.1/releases/2.2.5.html
条件式 8237
条件式 Conditional expressions let you use if ... elif ... else logic within filters, annotations, aggregations, and updates. A conditional expression evaluates a series of conditions for each row of a table and returns the matching result ... 用します: from django.db import models class Client ( models . Model ): REGULAR = "R" GOLD = "G" PLATINUM = "P" ACCOUNT_TYPE_CHOICES = { REGULAR : "Regular" , GOLD : "Gold" , PLATINUM : "Platinum" , } name = models . CharField ( max_length = 50 ) register ... ed_on = models . DateField () account_type = models . CharField ( max_length = 1 , choices = ACCOUNT_TYPE_CHOICES , default = REGULAR , ) When class When ( condition = None , then = None , ** lookups ) [ソース] Wh ...
https://man.mtool.work/django/6.1/ref/models/conditional-expressions.html
Django 3.0 リリースノート 8237
Django 3.0 リリースノート 2019年12月2日 Django 3.0 へようこそ! このリリースノートでは、 バージョン 3.0 の新機能 と、Django 2.2 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。 非推奨サイクルが終了した機能 ... in QuerySet filters, without having to first annotate and then filter against the annotation. Enumerations for model field choices Custom enumeration types TextChoices , IntegerChoices , and Choices are now available as a way to define Field.choices . T ... extChoices and IntegerChoices types are provided for text and integer fields. The Choices class allows defining a compatible enumerat ...
https://man.mtool.work/django/6.1/releases/3.0.html
PREV 1 2 3 4 NEXT