per page, with , order by , clip by
Results of 1 - 10 of about 164 for View (0.005 sec.)
Django のショートカット関数 9847
Django のショートカット関数 django.shortcuts パッケージは、MVC の複数のレベルにまたがるヘルパー関数とクラスを集めたものです。言い換えれば、これらの関数やクラスは、便宜上、控えめな結合を取り入れます。 render() render ( request , template_nam ... myapp/index.html をMIMEタイプ application/xhtml+xml でレンダリングしてみます。 from django.shortcuts import render def my_view ( request ): # View code here... return render ( request , "myapp/index.html" , { "foo" : "bar" , }, content_type = "appli ... tml+xml" , ) この例は次のコードと等価です。 from django.http import HttpResponse from django.template import loader def my_view ( request ): # View code here... t = loader . get_template ( "myapp/index.html" ) c = { "foo" : "bar" } return HttpRespons ... ェクトの get_absolute_url() メソッドが呼び出され、リダイレクト URL を返します: from django.shortcuts import redirect def my_view ( request ): ... obj = MyModel . objects . get ( ... ) return redirect ( obj ) ビューの名前と、オプションで位置引数またはキ ...
https://man.mtool.work/django/6.1/topics/http/shortcuts.html
ベース・ビュー 9494
ベース・ビュー 以下の3つのクラスは、Django のビューの作成に必要な多くの機能を提供します。これらは Django ビューの 親の ビューとみなすことができ、それ自体で使うことも継承して使うこともできます。プロジェクトに必要な全ての機能を提供するわけでは ... 原型のクラスは 継承元 (MRO) セクションにドキュメントがあります。MRO は メソッド解決順序 (Method Resolution Order) の略です。 View class django.views.generic.base. View 基本ビュークラス。他の全てのクラスベースのビューはこの基底クラスを継承します。厳密に ... はジェネリックビューではないので、 django.views からインポートすることもできます。 メソッドのフローチャート setup() dispatch() http_method_not_allowed() options() Exampl ... e views.py : from django.http import HttpResponse from django.views import View class MyView ( View ): def get ( self , request , ...
https://man.mtool.work/django/6.1/ref/class-based-views/base.html
クラスベースビュー 9198
クラスベースビュー ビューとは、リクエストを受け取り、レスポンスを返す呼び出し可能オブジェクトです。ビューは単なる関数以上のものにもなり得ます。Django ではビューとして使用できるいくつかのクラスを提供しており、これらを利用することで、ビューを ... 構造化し、継承やミックスインを活用してコードを再利用できます。また、汎用ビュー(generic view)も用意されていますが、それについては後ほど説明します。あなたのユースケースに合った再利用可能なビューの構造を設計することも ... ミックスイン (mixin) を使用する There are community-maintained solutions! Django has a vibrant ecosystem. There are generic view extensions highlighted on the Community Ecosystem page that build on Django's class-based views. The Django Packages Class ... Based Views grid has even more options for you! 基本的な例 Django は、さまざまなアプリケーションに広く適用できるベースビュークラスを用 ...
https://man.mtool.work/django/6.1/topics/class-based-views/
クラスベースビュー入門 9198
クラスベースビュー入門 クラスベースビューはビューを実装するもう一つの手段で、関数の代わりに Python のオブジェクトとしてビューを定義します。クラスベースビューは関数ベースのビューを完全に置き換えるものではありませんが、関数ベースのビューと比較 ... 、ビュー関数の場合に HTTP GET をハンドリングするコードが次のようになるとすると、 from django.http import HttpResponse def my_view ( request ): if request . method == "GET" : # <view logic> return HttpResponse ( "result" ) クラスベースのビューでは以下の ... ようになります。 from django.http import HttpResponse from django.views import View class MyView ( View ): def get ( self , request ): # <view logic> return HttpResponse ( "result" ) DjangoのUR ... 、クラスベースのビューには、関連するパターンに一致するURLに対するリクエストが到着したときに呼び出すことができる関数を返す as_view() クラスメソッドがあります。この関数はクラスのインスタンスを作成し、 setup() を呼び出してその属性を初期化し、次にその disp ...
https://man.mtool.work/django/6.1/topics/class-based-views/intro.html
クラスベースのジェネリックビュー: フラットインデックス 9027
クラスベースのジェネリックビュー: フラットインデックス この索引は、クラスベースビューのリファレンス文書を、異なる観点から編成したものです。ビューごとに、クラスツリーの有効な属性とメソッドが表されます。動作を定義するクラスの観点から編集された ... リファレンス文書は、 クラスベースビュー を参照してください。 参考 Classy Class-Based Views では、ビルトインのクラスベースビューのクラスのヒエラルキーがわかりやすく紹介されています。 シンプルなジェネリックビュー V ... iew class View 属性 (とオプションのアクセサ): http_method_names メソッド as_view() dispatch() head() http_method_not_allowed() setup() Te ... mplateView class TemplateView 属性 (とオプションのアクセサ): content_type extra_context http_method_names response_class [ render_to_ ...
https://man.mtool.work/django/6.1/ref/class-based-views/flattened-index.html
Django の admin サイト 8970
Django の admin サイト Django のパワフルな特徴の1つは、自動的に生成される admin インタフェースです。あなたのモデルクラスからメタデータを読み取り、モデル中心のインタフェースを提供します。このインタフェースのおかげで、ユーザはあなたのサイトの ... もできます: from django.contrib import admin class AuthorAdmin ( admin . ModelAdmin ): list_display = [ "name" , "title" , "view_birth_date" ] @admin . display ( empty_value = "???" ) def view_birth_date ( self , obj ): return obj . birth_date ModelAd ... は、フィールドレベルで以下のようにできます。 class PersonAdmin ( admin . ModelAdmin ): list_display = [ "name" , "birth_date_view" ] @admin . display ( empty_value = "unknown" ) def birth_date_view ( self , obj ): return obj . birth_date 与えられた文字 ... 可されていないデータが漏洩されるのを防ぐため、オートコンプリートを使うには、ユーザーは必ずリレーション先オブジェクトに対する view か change 権限を持っていなければなりません。 結果のソートおよびページ分割は、関係する ModelAdmin の get_ordering() と get_ ...
https://man.mtool.work/django/6.1/ref/contrib/admin/
クラスベースのビューでミックスイン (mixin) を使用する 8730
クラスベースのビューでミックスイン (mixin) を使用する 注意 This is an advanced topic. A working knowledge of Django's class-based views is advised before exploring these techniques. Django のビルトインのクラスベースビューではたくさんの機能が ... 機能もあるかもしれません。たとえば、HTTP レスポンスを生成するテンプレートをレンダリングするビューを記述したいとき、 TemplateView は使えない状況もあります; POST ではテンプレートをレンダリングするだけで、 GET のときはまったく異なる処理がしたいときなどで ... スベースビュー内のテンプレートを扱うインターフェースに一貫性を保ちやすくなっています。 TemplateResponseMixin Every built in view which returns a TemplateResponse will call the render_to_response() method that TemplateResponseMixin provides. Most of th ... e time this will be called for you (for instance, it is called by the get() method implemented by both TemplateView and DetailView ); similarly, it's unlikely that you'll need to override it, although if you want your response to return s ...
https://man.mtool.work/django/6.1/topics/class-based-views/mixins.html
コンテンツセキュリティポリシー 8548
コンテンツセキュリティポリシー New in Django 6.0. Content Security Policy (CSP) is a web security standard that helps prevent content injection attacks by restricting the sources from which content can be loaded. It plays an important role ... explanation in Nonce usage . デコレータ Django provides decorators to control the Content Security Policy headers on a per-view basis. These allow overriding or disabling the enforced or report-only policy for specific views, providing fine-grained c ... n" policy, an attacker could exploit a vulnerability on one page to access other parts of the site. csp_override ( config)(view ) [ソース] Overrides the Content-Security-Policy header for the decorated view using directives in the same format as the ... directives. If config is an empty mapping ( {} ), no CSP enforcement header will be added to the response returned by that view, effectively disabling CSP for that view. 例: from django.http import HttpResponse from django.utils.csp import CSP from d ...
https://man.mtool.work/django/6.1/ref/csp.html
URLconf で使用するための django.urls 関数 7967
URLconf で使用するための django.urls 関数 path() path ( route , view , kwargs = None , name = None ) urlpatterns に含める要素を返します。例えば: from django.urls import include , path urlpatterns = [ path ( "index/" , views . index , name = ... "main-view" ), path ( "bio/<username>/" , views . bio , name = "bio" ), path ( "articles/<slug:title>/" , views . article , name = "a ... rticle-detail" ), path ( "articles/<slug:title>/<int:section>/" , views . section , name = "article-section" ), path ( "blog/" , include ( "blog.urls" )), ... , ] route The route argument shoul ... ing may contain angle brackets (like <username> above) to capture part of the URL and send it as a keyword argument to the view. The angle brackets may include a converter specification (like the int part of <int:section> ) which limits the character ...
https://man.mtool.work/django/6.1/ref/urls.html
Django 2.2.8 リリースノート 7898
Django 2.2.8 リリースノート 2019年12月2日 Django 2.2.8 fixes a security issue, several bugs in 2.2.7, and adds compatibility with Python 3.8. CVE-2019-19118: Privilege escalation in the Django admin. Since Django 2.1, a Django model admin d ... isplaying a parent model with related model inlines, where the user has view-only permissions to a parent model but edit permissions to the inline model, would display a read-only view of the parent ... olve this issue, the permission handling code of the Django admin interface has been changed. Now, if a user has only the "view" permission for a parent model, the entire displayed form will not be editable, even if the user has permission to edit mo ... ware that some users of Django were depending on the ability to allow editing of inlines in the admin form of an otherwise view-only parent model. Given the complexity of the Django admin, and in-particular the permissions related checks, it is the v ...
https://man.mtool.work/django/6.1/releases/2.2.8.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT