per page, with , order by , clip by
Results of 1 - 10 of about 15 for Reporter (0.005 sec.)
多対一 (many-to-one) 関係 14333
多対一 (many-to-one) 関係 多対一のリレーションシップを定義するには ForeignKey を使います。 この例では、 Reporter は複数の Article オブジェクトと関連付けることができますが、 Article は一つの Reporter オブジェクトしか持つことができません: fro ... m django.db import models class Reporter ( models . Model ): first_name = models . CharField ( max_length = 30 ) last_name = models . CharField ( max_length = 30 ) ... } " class Article ( models . Model ): headline = models . CharField ( max_length = 100 ) pub_date = models . DateField () reporter = models . ForeignKey ( Reporter , on_delete = models . CASCADE ) def __str__ ( self ): return self . headline class Meta ... : ordering = [ "headline" ] 以下は、Python API の機能を使って実行できる操作の例です。 複数の Reporter を作成する: >>> r = Reporter ( first_name = "John" , last_name = "Smith" , email = "john@example.com" ) >>> r . save () >> ...
https://man.mtool.work/django/6.1/topics/db/examples/many_to_one.html
Django の概要 11320
Django の概要 Django は変転の激しいニュースルーム環境で開発された経緯から、よくある Web 開発タスクを迅速かつ簡単化するように設計されています。ここでは Django による データベースを使った Web アプリケーション開発をざっと見てみましょう。 このド ... ベーススキーマの問題を解決してきた実績があります。 簡単な例を示しましょう: news/models.py from django.db import models class Reporter ( models . Model ): full_name = models . CharField ( max_length = 70 ) def __str__ ( self ): return self . full_name class ... del ): pub_date = models . DateField () headline = models . CharField ( max_length = 200 ) content = models . TextField () reporter = models . ForeignKey ( Reporter , on_delete = models . CASCADE ) def __str__ ( self ): return self . headline モデルのイン ... 、コードを作成する必要はありません: # Import the models we created from our "news" app >>> from news.models import Article , Reporter # No reporters are in the system yet. >>> Reporter . objects . all () <QuerySet []> # Create a new Reporter. >>> r = Repor ...
https://man.mtool.work/django/6.1/intro/overview.html
クエリ式 (Query Expression) 8847
クエリ式 (Query Expression) クエリ式 (query expression) は、update、create、filter、order by、annotation、またはaggregateの一部として使用できる値または計算を記述します。式が真偽値を出力する場合、フィルタで直接使用できます。クエリの記述に使用 ... レベルで必要な操作を記述する SQL 式を生成します。 例でやってみましょう。通常はこのようにします: # Tintin filed a news story! reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed += 1 reporter . save () ここでは、 reporter.stori ... そのオブジェクトをデータベースに保存しています。しかし、代わりに次のようにすることもできます: from django.db.models import F reporter = Reporters . objects . get ( name = "Tintin" ) reporter . stories_filed = F ( "stories_filed" ) + 1 reporter . save () re ... Djangoが F() インスタンスを見つけると、標準のPython演算子をオーバーライドしてカプセル化されたSQL式を作成します。この場合、 reporter.stories_filed によって表されるデータベースフィールドをインクリメントするようにデータベースに指示する式が作成されます。 rep ...
https://man.mtool.work/django/6.1/ref/models/expressions.html
エラーレポートの管理 8812
エラーレポートの管理 サイトを公開している場合、 DEBUG 設定は常にオフにしておかなければなりません。これにより、サーバー動作は高速になり、エラーページによって明らかになるアプリケーションの詳細が悪意あるユーザーに漏れるのを防ぎます。 しかし、 ... アノテートするだけです。実際のフィルタリングは Django のデフォルトのエラーレポートフィルタ ( django.views.debug.SafeExceptionReporterFilter ) で行われます。このフィルタはデコレータのアノテーションを使い、エラーレポートが生成される際に、対応する値をアスタリ ... 。このデフォルトの動作を上書きしたり、サイト全体でカスタマイズしたい場合は、独自のフィルタクラスを定義し、 DEFAULT_EXCEPTION_REPORTER_FILTER 設定でそれを使うように Django に指示する必要があります: DEFAULT_EXCEPTION_REPORTER_FILTER = "path.to.your.CustomExc ... eptionReporterFilter" また、 HttpRequest の exception_reporter_filter 属性を指定することで、任意のビューで使用するフィルタをより細かく制御 ...
https://man.mtool.work/django/6.1/howto/error-reporting.html
ロギング 8202
ロギング 参考 ロギングの設定と利用 Django のロギングの概要 Django の logging モジュールは Python の 組み込み logging モジュールを継承しています。 Logging は、一般的なDjangoの django.setup() 関数の一部として設定されているため、明示的に無効に ... るもの に加えて、1つのログハンドラを提供しています。 class AdminEmailHandler ( include_html = False , email_backend = None , reporter_class = None , using = None ) [ソース] このハンドラは、受け取ったログメッセージごとにサイトの ADMINS に電子メールを送信しま ... idden. email_backend is not supported when MAILERS is defined or when the using argument is provided. AdminEmailHandler の reporter_class 引数では、メール本文で送信されるトレースバックテキストをカスタマイズするために django.views.debug.ExceptionReporter ... dlers" : { "mail_admins" : { "level" : "ERROR" , "class" : "django.utils.log.AdminEmailHandler" , "include_html" : True , "reporter_class" : "somepackage.error_reporter.CustomErrorReporter" , }, } Changed in Django 6.1: using 引数が追加されました。 バージ ...
https://man.mtool.work/django/6.1/ref/logging.html
ジェネリック表示ビュー (Generic display view) 8133
ジェネリック表示ビュー (Generic display view) 以下の2つのクラスベースのジェネリックビューは、データを表示 (display) するために設計されています。多くのプロジェクトで、これらは最もよく使われるビューです。 DetailView class django.views.generic ... e-detail" ), ] 例 myapp/article_detail.html : < h1 > {{ object.headline }} </ h1 > < p > {{ object.content }} </ p > < p > Reporter: {{ object.reporter }} </ p > < p > Published: {{ object.pub_date | date }} </ p > < p > Date: {{ now | date }} </ p > cla ...
https://man.mtool.work/django/6.1/ref/class-based-views/generic-display.html
Django 3.1 リリースノート 8028
Django 3.1 リリースノート August 4, 2020 Django 3.1 へようこそ! このリリースノートでは、 バージョン 3.1 の新機能 と、Django 3.0 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。 非推奨サイクルが終了した機能 ... FILE_PATH setting, used by the file email backend , now supports pathlib.Path . エラー報告 django.views.debug.SafeExceptionReporterFilter now filters sensitive values from request.META in exception reports. The new SafeExceptionReporterFilter.cleansed_su ... bstitute and SafeExceptionReporterFilter.hidden_settings attributes allow customization of sensitive settings and request.META filtering in exception reports ... . The technical 404 debug view now respects DEFAULT_EXCEPTION_REPORTER_FILTER when applying settings filtering. The new DEFAULT_EXCEPTION_REPORTER allows providing a django.views.debug.Exceptio ...
https://man.mtool.work/django/6.1/releases/3.1.html
モデルからフォームを作成する 7959
モデルからフォームを作成する ModelForm class ModelForm [ソース] データベース中心のアプリケーションを作成している場合、Django モデルに密接にマップするフォームを使うことになるでしょう。例えば、 BlogComment モデルを持っていて、閲覧者がコメント ... lass ArticleForm ( ModelForm ): ... class Meta : ... model = Article ... fields = [ "pub_date" , "headline" , "content" , "reporter" ] ... # Creating a form to add an article. >>> form = ArticleForm () # Creating a form to change an existing article. >>> ... rt Article class ArticleForm ( ModelForm ): class Meta : model = Article fields = [ "pub_date" , "headline" , "content" , "reporter" , "slug" ] field_classes = { "slug" : MySlugFormField , } もしくは: from django.forms import ModelForm from myapp.models ... * kwargs ) class ArticleForm ( ModelForm ): class Meta : model = Article fields = [ "pub_date" , "headline" , "content" , "reporter" , "slug" ] formfield_callback = formfield_for_dbfield 最後に、フィールドを完全に -- タイプ、バリデータ、必須かどうかなどを ...
https://man.mtool.work/django/6.1/topics/forms/modelforms.html
チケットをトリアージする 7924
チケットをトリアージする Django uses Trac for managing the work on the code base. Trac is a community-tended garden of the bugs people have found and the features Django has decided to add. As in any garden, sometimes there are weeds to be ... a big responsibility, though. You have to be sure that the issue is really resolved, and you need to keep in mind that the reporter of the ticket may not be happy to have their ticket closed (unless it's fixed!). If you're not certain about closing a tic ... he request isn't appropriate for consideration in Django. Sometimes a ticket is closed as "wontfix" with a request for the reporter to start a discussion on the Django Forum if they feel differently from the rationale provided by the person who closed th ...
https://man.mtool.work/django/6.1/internals/contributing/triaging-tickets.html
リクエストとレスポンスのオブジェクト 7924
リクエストとレスポンスのオブジェクト 簡単な概要 Django は、システムを通じてステータスを渡すために、リクエストとレスポンスのオブジェクトを使います。 あるページがリクエストされたとき、Django はリクエストに関するメタデータを含んだ HttpRequest ... ことで、それまでにミドルウェアで行われた変更を取り消し、元の ROOT_URLCONF を使用するようにできます。 HttpRequest. exception_reporter_filter これは、現在のリクエストに対して DEFAULT_EXCEPTION_REPORTER_FILTER の代わりに使用されます。詳細については、 カスタム ... エラーレポート を参照してください。 HttpRequest. exception_reporter_class これは、現在のリクエストに対して DEFAULT_EXCEPTION_REPORTER の代わりに使用されます。詳細については カスタムエラーレポ ...
https://man.mtool.work/django/6.1/ref/request-response.html
PREV 1 2 NEXT