per page, with , order by , clip by
Results of 1 - 5 of about 5 for namedtuple (0.012 sec.)
素の SQL 文の実行 12832
素の SQL 文の実行 Django gives you three ways of performing raw SQL queries: you can embed raw SQL fragments into ORM queries using RawSQL (see Raw SQL fragments ), use Manager.raw() to perform raw queries and return model instances , or av ... [ dict ( zip ( columns , row )) for row in cursor . fetchall ()] 別の選択肢は Python 標準ライブラリに含まれる collections.namedtuple() を利用する事です。 namedtuple は属性を指定して値へのアクセスが可能なタプルに似たオブジェクトです; 加えてインデックスが利 ... レート可能でもあります。取得した結果は不変であり属性名もしくはインデックスでアクセスできて便利です: from collections import namedtuple def namedtuplefetchall ( cursor ): """ Return all rows from a cursor as a namedtuple. Assume the column names are unique. ... """ desc = cursor . description nt_result = namedtuple ( "Result" , [ col [ 0 ] for col in desc ]) return [ nt_result ( * row ) for row in cursor . fetchall ()] dictfetchall() と ...
https://man.mtool.work/django/6.1/topics/db/sql.html
組み込みテンプレートタグとフィルタ 8493
組み込みテンプレートタグとフィルタ このドキュメントでは、 Django の組み込みテンプレートタグとフィルタについて述べます。 また 自動ドキュメンテーション を使えばインストールされている組み込みタグとカスタムタグのドキュメントを読めるのでお勧めで ... 呼んでいます。 {% regroup %} produces a list (in this case, country_list ) of group objects . Group objects are instances of namedtuple() with two fields: grouper -- グループ分けに使われた要素 ( ここでは "India" "Japan" といった文字列 ) list -- このグループ内 ... のすべての要素からなるリスト ( たとえば country='India' であるすべての都市のリスト) Because {% regroup %} produces namedtuple() objects, you can also write the previous example as: {% regroup cities by country as country_list %} < ul > {% for count ...
https://man.mtool.work/django/6.1/ref/templates/builtins.html
Django 1.5 リリースノート 8493
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 ... ings, the optional C implementation can return a bytestring. This was fixed in Python 2.7. simplejson.JSONEncoder gained a namedtuple_as_object keyword argument in version 2.2. More information on these incompatibilities is available in ticket #18023 . The ...
https://man.mtool.work/django/6.1/releases/1.5.html
Django 1.11 リリースノート 8199
Django 1.11 リリースノート April 4, 2017 Django 1.11 へようこそ! このリリースノートでは、Django 1.10 および過去のバージョンからアップグレードする際に知っておくべきいくつかの 後方互換性のない変更 に加え、 新機能 を説明しています。 いくつかの ... ackend now supports context processors by setting the 'context_processors' option in OPTIONS . The regroup tag now returns namedtuple s instead of dictionaries so you can unpack the group object directly in a loop, e.g. {% for grouper, list in regrouped %} ...
https://man.mtool.work/django/6.1/releases/1.11.html
QuerySet API リファレンス 7905
QuerySet API リファレンス このドキュメントでは、 QuerySet API の詳細を説明しています。 モデル と データベースクエリ ガイドにある説明を前提としていますので、このドキュメントを読む前にこの 2 つを読んでおくことをおすすめします。 このリファレン ... , flat = True ) . order_by ( "id" ) <QuerySet [1, 2, 3, ...]> 複数のフィールドがある場合に flat を渡すとエラーになります。 namedtuple() : として結果を得るには、 named=True を渡します: >>> Entry . objects . values_list ( "id" , "headline" , named = True ) < ...
https://man.mtool.work/django/6.1/ref/models/querysets.html
PREV 1 NEXT