per page, with , order by , clip by
Results of 1 - 10 of about 72 for json (0.006 sec.)
フィクスチャ (fixture) 13888
フィクスチャ (fixture) フィクスチャ (fixture) とは、シリアライズされたデータベースのコンテンツを含むファイルのコレクションです。各フィクスチャにはユニークな名前があり、フィクスチャを構成するファイルは、複数のアプリケーションの複数のディレク ... 定されたフィクスチャに拡張子がある場合、そのタイプのフィクスチャだけが読み込まれます。たとえば django-admin loaddata mydata.json mydata と呼ばれる JSON フィクスチャのみを読み込みます。フィクスチャの拡張子は シリアライザ に登録された名前 (例: json や x ... go-admin loaddata mydata これは mydata というフィクスチャタイプのフィクスチャを探します。フィクスチャディレクトリに mydata.json が含まれていれば、そのフィクスチャは JSON フィクスチャとして読み込まれます。 命名されたフィクスチャはディレクトリ・コンポー ... ネントを含むことができます。これらのディレクトリは検索パスに含まれます。たとえば: django-admin loaddata foo/bar/mydata.json これは、インストールされている各アプリケーションに対して <app_label>/fixtures/foo/bar/mydata.json を、 FIXTURE_DIRS 内の各 ...
https://man.mtool.work/django/6.1/topics/db/fixtures.html
Django オブジェクトのシリアライズ 12893
Django オブジェクトのシリアライズ Django のシリアライズフレームワークは、Django のモデルを他のフォーマットに「翻訳」する仕組みを提供します。通常、このような他のフォーマットはテキストベースや Django データをネットワーク越しに送信するために使 ... いレベルでは、次のようにデータをシリアライズできます。 from django.core import serializers data = serializers . serialize ( "json" , SomeModel . objects . all ()) serialize 関数の引数は、データをシリアライズするフォーマット ( シリアライズフォーマット ) ... す。) django.core.serializers. get_serializer ( format ) シリアライザーオブジェクトを次のように直接使用することもできます。 JSONSerializer = serializers . get_serializer ( "json" ) json_serializer = JSONSerializer () json_serializer . serialize ( quer ... yset ) data = json_serializer . getvalue () これは次のようにデータをファイルライクなオブジェクト ( HttpResponse を含む) に直接シリアライズした ...
https://man.mtool.work/django/6.1/topics/serialization.html
クラスベースのビューでミックスイン (mixin) を使用する 10118
クラスベースのビューでミックスイン (mixin) を使用する 注意 This is an advanced topic. A working knowledge of Django's class-based views is advised before exploring these techniques. Django のビルトインのクラスベースビューではたくさんの機能が ... response to return something not rendered via a Django template then you'll want to do it. For an example of this, see the JSONResponseMixin example . render_to_response() 自体は get_template_names() を呼び出しますが、デフォルトではクラスベースのビュ ... に立つのは、同じことを何度もしたい場合です。たとえば API を作成している場合、全てのビューはレンダリングされた HTML ではなく JSON を返す必要があります。 全てのビューで利用するために、 JSONへの変換処理をするmixinクラスを作成できます。 たとえば、JSONのmi ... xinは以下のようになるでしょう。 from django.http import JsonResponse class JSONResponseMixin : """ A mixin that can be used to render a JSON response. """ def render_to_json_response ...
https://man.mtool.work/django/6.1/topics/class-based-views/mixins.html
Django 1.5.3 リリースノート 9277
Django 1.5.3 リリースノート September 10, 2013 This is Django 1.5.3, the third release in the Django 1.5 series. It addresses one security issue and also contains an opt-in feature to enhance the security of django.contrib.sessions . Direct ... diately escalates to a remote code execution vulnerability. This attack can be mitigated by serializing session data using JSON rather than pickle . To facilitate this, Django 1.5.3 introduces a new setting, SESSION_SERIALIZER , to customize the sess ... ion serialization format. For backwards compatibility, this setting defaults to using pickle . While JSON serialization does not support all Python objects like pickle does, we highly recommend switching to JSON-serialized value ... s. Also, as JSON requires string keys, you will likely run into problems if you are using non-string keys in request.session . See the セッ ...
https://man.mtool.work/django/6.1/releases/1.5.3.html
Django 1.5 リリースノート 8703
Django 1.5 リリースノート February 26, 2013 Django 1.5 へようこそ! 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 1.4 or older versions. We'v ... P methods aren't implemented by web browsers. Rather, they're used in APIs, which transfer data in various formats such as JSON or XML. Since such requests may contain arbitrary data, Django doesn't attempt to decode their body. However, the test cli ... you must encode your data before passing it to the test client and set the content_type argument. System version of simplejson no longer used As explained below , Django 1.5 deprecates django.utils.simplejson in favor of Python 2.6's built-in json m ... odule. In theory, this change is harmless. Unfortunately, because of incompatibilities between versions of simplejson , it may trigger errors in some circumstances. JSON-related features in Django 1.4 always used django.utils.simplejson . T ...
https://man.mtool.work/django/6.1/releases/1.5.html
Django's Tasks framework 8534
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 ... aenqueue() is available as an async variant of enqueue() . Because both Task arguments and return values are serialized to JSON, they must be JSON-serializable: >>> process_data . enqueue ( datetime . now ()) Traceback (most recent call last): ... Ty ... peError : Object of type datetime is not JSON serializable Arguments must also be able to round-trip through a json.dumps() / json.loads() cycle without changing type. ... ceback (most recent call last): ... TypeError : unhashable type: 'list' The double_dictionary Task fails because after the JSON round-trip the tuple (1, 2, 3) becomes the list [1, 2, 3] , which cannot be used as a dictionary key. In general, complex ...
https://man.mtool.work/django/6.1/topics/tasks.html
テストツール 8534
テストツール Django は、テストを書くのに便利なツールをいくつか提供しています。 There are community-maintained solutions! Django has a vibrant ecosystem. There are testing and fixtures solutions highlighted on the Community Ecosystem page. T ... 成には、 django.test.Client クラスを使います。 class Client ( enforce_csrf_checks = False , raise_request_exception = True , json_encoder = DjangoJSONEncoder , * , headers = None , query_params = None , ** defaults ) [ソース] テスト用の HTTP クライアン ... ion 引数を指定することで、リクエスト中に発生した例外をテストでも発生させるかどうかを制御できます。デフォルトは True です。 json_encoder 引数を指定すると、 post() に記述されているJSONシリアライズ用のカスタムJSONエンコーダを指定できます。 Client インス ... ( ... "/customers/details/" , ... query_params = { "name" : "fred" , "age" : 7 }, ... headers = { "accept" : "application/json" }, ... ) ...will send the HTTP header HTTP_ACCEPT to the details view, which is a good way to test code paths that use th ...
https://man.mtool.work/django/6.1/topics/testing/tools.html
Django 3.1 リリースノート 8450
Django 3.1 リリースノート August 4, 2020 Django 3.1 へようこそ! このリリースノートでは、 バージョン 3.1 の新機能 と、Django 3.0 以前からアップグレードする際に注意すべき、 後方互換性のない変更 について説明します。 非推奨サイクルが終了した機能 ... peed regressions for your existing, synchronous code. It should have no noticeable effect on any existing Django projects. JSONField for all supported database backends Django now includes models.JSONField and forms.JSONField that can be used on all ... supported database backends. Both fields support the use of custom JSON encoders and decoders. The model field supports the introspection, lookups, and transforms that were previously PostgreSQL ... -only: from django.db import models class ContactInfo ( models . Model ): data = models . JSONField () ContactInfo . objects . create ( data = { "name" : "John" , "cities" : [ "London" , "Cambridge" ], "pets" : { "dog ...
https://man.mtool.work/django/6.1/releases/3.1.html
クエリを作成する 8366
クエリを作成する 一度 データモデル を作成すれば、Django はデータオブジェクトの作成、取得、更新および削除を行えるようにデータベースを抽象化した API を自動的に提供します。本ドキュメントではこの API をどのように用いるかを説明します。多様なモデ ... の同期関数の中に記述し、 sync_to_async を使用して呼び出すことをおすすめします。詳しくは 非同期サポート を参照してください。 JSONField へのクエリ JSONField では、ルックアップの実装は主にキーのトランスフォーム(変換)の存在によって異なります。デモンスト ... from django.db import models class Dog ( models . Model ): name = models . CharField ( max_length = 200 ) data = models . JSONField ( null = True ) def __str__ ( self ): return self . name None の保存とクエリ As with other fields, storing None as th ... e field's value will store it as SQL NULL . While not recommended, it is possible to store JSON scalar null instead of SQL NULL by using the JSONNull() expression. どちらの値が格納されていても、データベースから取得した ...
https://man.mtool.work/django/6.1/topics/db/queries.html
リクエストとレスポンスのオブジェクト 8030
リクエストとレスポンスのオブジェクト 簡単な概要 Django は、システムを通じてステータスを渡すために、リクエストとレスポンスのオブジェクトを使います。 あるページがリクエストされたとき、Django はリクエストに関するメタデータを含んだ HttpRequest ... が指定されたいずれのタイプも受け入れない場合は None を返します。 クライアントが Accept ヘッダーとして text/html,application/json;q=0.8 を送信したと仮定します。 >>> request . get_preferred_type ([ "text/html" , "application/json" ]) "text/html" >>> req ... uest . get_preferred_type ([ "application/json" , "text/plain" ]) "application/json" >>> request . get_preferred_type ([ "application/xml" , "text/plain" ]) None MIME タ ... s from django.http import HttpResponse class HttpResponseNoContent ( HttpResponse ): status_code = HTTPStatus . NO_CONTENT JsonResponse オブジェクト class JsonResponse ( data , encoder = DjangoJSONEncoder , safe = True , json_dumps_params = None , ** ...
https://man.mtool.work/django/6.1/ref/request-response.html
PREV 1 2 3 4 5 6 7 8 NEXT