per page, with , order by , clip by
Results of 1 - 10 of about 41 for print (0.007 sec.)
測定オブジェクト 13071
測定オブジェクト django.contrib.gis.measure モジュールには、距離や面積の単位を便利に表現するためのオブジェクトが含まれています。 [ 1 ] 具体的には、 Distance と Area の 2 つのオブジェクトを実装しており、それぞれ D と A の便利なエイリアスを介 ... lometers ( km ) and miles ( mi ): >>> from django.contrib.gis.measure import D , Distance >>> d1 = Distance ( km = 5 ) >>> print ( d1 ) 5.0 km >>> d2 = D ( mi = 5 ) # `D` is an alias for `Distance` >>> print ( d2 ) 5.0 mi 変換には、変換された距離の量を ... 取得するために好ましい単位属性にアクセスします: >>> print ( d1 . mi ) # Converting 5 kilometers to miles 3.10685596119 >>> print ( d2 . km ) # Converting 5 miles to kilometers 8.04 ... 672 また、距離オブジェクト間で算術演算を行うこともできます: >>> print ( d1 + d2 ) # Adding 5 miles to 5 kilometers 13.04672 km >>> print ( d2 - d1 ) # Subtracting 5 kilometers from 5 miles 1.8 ...
https://man.mtool.work/django/6.1/ref/contrib/gis/measure.html
フォームアセット (Media クラス) 12076
フォームアセット ( Media クラス) 魅力的で使いやすいウェブのフォームを作るには、HTML だけでは不十分です。CSS スタイルシートも必要です。さらに豪華なウィジェットを使いたければ、JavaScript を各ページに配置する必要もあるでしょう。あるページに必要 ... 変換されます。 CalendarWidget インスタンスのアセットリストは、このプロパティから取得できます: >>> w = CalendarWidget () >>> print ( w . media ) <link href="https://static.example.com/pretty.css" media="all" rel="stylesheet"> <script src="https://static ... イプを表します。これらは CSS ファイル認識可能なメディアタイプと同じです: 'all'、'aural'、'braille'、'embossed'、'handheld'、'print'、'projection'、'screen'、'tty'、'tv'。メディアタイプに応じたスタイルシートを提供する必要がある場合、各出力メディアに対して ... SS オプションを提供します -- 1 つはスクリーン用でもう一つは印刷用です: class Media : css = { "screen" : [ "pretty.css" ], "print" : [ "newspaper.css" ], } 1 つのCSS ファイルのグループを複数の出力メディアタイプに適用するには、出力メディアタイプをカンマ ...
https://man.mtool.work/django/6.1/topics/forms/media.html
フォーム API 11812
フォーム API このドキュメントについて このドキュメントでは、Django のフォーム API の詳細について説明します。このドキュメントを読む前に フォームについての概要 を読むことをおすすめします。 バインドされた (bound) フォームとバインドされていない ... d () ... comment = forms . CharField () ... >>> f = CommentForm ( initial = { "name" : "instance" }, auto_id = False ) >>> print ( f ) <div>Name:<input type="text" name="name" value="instance" required></div> <div>Url:<input type="url" name="url" requ ... ields Form インスタンスのフィールドには、その fields 属性からアクセスできます。 >>> for row in f . fields . values (): ... print ( row ) ... <django.forms.fields.CharField object at 0x7ffaac632510> <django.forms.fields.URLField object at 0x7ffaac632f9 ... ムをHTMLとしてアウトプットする Form オブジェクトの2番目のタスクは、自身をHTMLとしてレンダリングすることです。それを行うには print します。 >>> f = ContactForm () >>> print ( f ) <div><label for="id_subject">Subject:</label><input type="text" name="subj ...
https://man.mtool.work/django/6.1/ref/forms/api.html
データベース関数 10895
データベース関数 The classes documented below provide a way for users to use functions provided by the underlying database as annotations, aggregations, or filters in Django. Functions are also expressions , so they can be used and combined ... author = Author . objects . annotate ( ... age_as_float = Cast ( "age" , output_field = FloatField ()), ... ) . get () >>> print ( author . age_as_float ) 25.0 Coalesce class Coalesce ( * expressions , ** extra ) [ソース] 少なくとも2つのフィールド名ま ... Maggie" ) >>> author = Author . objects . annotate ( screen_name = Coalesce ( "alias" , "goes_by" , "name" )) . get () >>> print ( author . screen_name ) Maggie >>> # Prevent an aggregate Sum() from returning None >>> # The aggregate default argument ... . combined_age_default = Sum ( "age" , default = 0 ), ... combined_age_coalesce = Coalesce ( Sum ( "age" ), 0 ), ... ) >>> print ( aggregated [ "combined_age" ]) None >>> print ( aggregated [ "combined_age_default" ]) 0 >>> print ( aggregated [ "combi ...
https://man.mtool.work/django/6.1/ref/models/database-functions.html
GeoDjango チュートリアル 9543
GeoDjango チュートリアル はじめに GeoDjangoは、Django用の標準のcontribモジュールであり、それを世界クラスの地理情報Webフレームワークに変えます。GeoDjangoは、位置情報サービスなどの地理情報Webアプリケーションを作成するのを可能な限り簡単にするこ ... rders shapefile を開いてください: >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource ( world_shp ) >>> print ( ds ) / ... /geodjango/world/data/TM_WORLD_BORDERS-0.3.shp (ESRI Shapefile) データソースオブジェクトは異なるレイヤーの地理 ... 空間フィーチャを持つことができます。しかし、シェープファイルは 1 つのレイヤーしか持つことができません: >>> print ( len ( ds )) 1 >>> lyr = ds [ 0 ] >>> print ( lyr ) TM_WORLD_BORDERS-0.3 レイヤーのジオメトリタイプと、含まれているフィー ... チャの数を確認できます: >>> print ( lyr . geom_type ) Polygon >>> print ( len ( lyr )) 246 注釈 Unfortunately, the shapefile data format does not allow for ...
https://man.mtool.work/django/6.1/ref/contrib/gis/tutorial.html
GEOS API 8905
GEOS API 背景 GEOS とは? GEOS stands for Geometry Engine - Open Source , and is a C++ library, ported from the Java Topology Suite . GEOS implements the OpenGIS Simple Features for SQL spatial predicate functions and spatial operators. GEOS ... 、キーワード引数 srid を受け取ります。例えば: >>> from django.contrib.gis.geos import GEOSGeometry , LineString , Point >>> print ( GEOSGeometry ( "POINT (0 0)" , srid = 4326 )) SRID=4326;POINT (0 0) >>> print ( LineString (( 0 , 0 ), ( 1 , 1 ), srid = ... 4326 )) SRID=4326;LINESTRING (0 0, 1 1) >>> print ( Point ( 0 , 0 , srid = 32140 )) SRID=32140;POINT (0 0) 最後に、ファイルから GEOSGeometry オブジェクトを返す fromfile() フ ... rib.gis.geos import LineString >>> ls1 = LineString (( 0 , 0 ), ( 2 , 2 )) >>> ls2 = LineString (( 1 , 1 ), ( 3 , 3 )) >>> print ( ls1 | ls2 ) # equivalent to `ls1.union(ls2)` MULTILINESTRING ((0 0, 1 1), (1 1, 2 2), (2 2, 3 3)) >>> print ( ls1 & ls2 ...
https://man.mtool.work/django/6.1/ref/contrib/gis/geos.html
LayerMapping データインポートユーティリティ 8455
LayerMapping データインポートユーティリティ LayerMapping クラスは、ベクトル空間データファイル (例: shapefile) の内容を GeoDjango モデルにマッピングする方法を提供します。 このユーティリティは、ベクターレイヤーからジオメトリとフィールドを取り ... います): >>> from django.contrib.gis.gdal import DataSource >>> ds = DataSource ( "test_poly.shp" ) >>> layer = ds [ 0 ] >>> print ( layer . fields ) # Exploring the fields in the layer, we only want the 'str' field. ['float', 'int', 'str'] >>> print ( ... len ( layer )) # getting the number of features in the layer (should be 3) 3 >>> print ( layer . geom_type ) # Should be 'Polygon' Polygon >>> print ( layer . srs ) # WGS84 in WKT GEOGCS["GCS_WGS_1984", DATUM[ ... rt a subset range of features in the geographic data source. progress When this keyword is set, status information will be printed giving the number of features processed and successfully saved. By default, progress information will be printed every 1 ...
https://man.mtool.work/django/6.1/ref/contrib/gis/layermapping.html
クエリを作成する 8455
クエリを作成する 一度 データモデル を作成すれば、Django はデータオブジェクトの作成、取得、更新および削除を行えるようにデータベースを抽象化した API を自動的に提供します。本ドキュメントではこの API をどのように用いるかを説明します。多様なモデ ... >>> q = q . filter ( pub_date__lte = datetime . date . today ()) >>> q = q . exclude ( body_text__icontains = "food" ) >>> print ( q ) この例ではデータベースに3回アクセスしているように見えますが、実際にアクセスしているのは、最終行 ( print(q) ) での1回 ... と、痛い目を見るかもしれません。たとえば、次のようにしてしまうと QuerySet が 2 つ作成され、評価され、そして破棄されます: >>> print ([ e . headline for e in Entry . objects . all ()]) >>> print ([ e . pub_date for e in Entry . objects . all ()]) つまり、 ... ない可能性もあります。 この問題を回避するには、 QuerySet を保存して再利用します: >>> queryset = Entry . objects . all () >>> print ([ p . headline for p in queryset ]) # Evaluate the query set. >>> print ([ p . pub_date for p in queryset ]) # Reuse the ...
https://man.mtool.work/django/6.1/topics/db/queries.html
GDAL API 8361
GDAL API 概要 GDAL stands for Geospatial Data Abstraction Library , and is a veritable "Swiss army knife" of GIS data functionality. A subset of GDAL is the OGR Simple Features Library, which specializes in reading and writing vector geogra ... する OGRGeomType であり、 DataSource 内の各レイヤーに関する基本情報を出力するために使用できます。 >>> for layer in ds : ... print ( 'Layer " %s ": %i %s s' % ( layer . name , len ( layer ), layer . geom_type . name )) ... Layer "cities": 3 Points 上記で ... ple (-104.609252, 29.763374, -95.23506, 38.971823) srs このレイヤーに関連付けられた SpatialReference を返すプロパティ: >>> print ( layer . srs ) GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0 ... 設定できます。 None 以外で設定された場合、レイヤーをイテレートするときにはフィルタと交差するフィーチャのみが返されます。 >>> print ( layer . spatial_filter ) None >>> print ( len ( layer )) 3 >>> [ feat . get ( "Name" ) for feat in layer ] ['Pueblo', 'L ...
https://man.mtool.work/django/6.1/ref/contrib/gis/gdal.html
フォームセット (Formset) 8097
フォームセット (Formset) class BaseFormSet [ソース] フォームセットは、同じページで複数のフォームを扱うための抽象レイヤーです。データグリッドに例えるとわかりやすいでしょう。次のようなフォームがあるとしましょう: >>> from django import forms > ... ォームをイテレートし、通常のフォームと同じように表示できます: >>> formset = ArticleFormSet () >>> for form in formset : ... print ( form ) ... <div><label for="id_form-0-title">Title:</label><input type="text" name="form-0-title" id="id_form-0-title">< ... "Django is now open source" , ... "pub_date" : datetime . date . today (), ... } ... ] ... ) >>> for form in formset : ... print ( form ) ... <div><label for="id_form-0-title">Title:</label><input type="text" name="form-0-title" value="Django is now o ... = formset_factory ( ArticleForm , extra = 2 , max_num = 1 ) >>> formset = ArticleFormSet () >>> for form in formset : ... print ( form ) ... <div><label for="id_form-0-title">Title:</label><input type="text" name="form-0-title" id="id_form-0-title">< ...
https://man.mtool.work/django/6.1/topics/forms/formsets.html
PREV 1 2 3 4 5 NEXT