per page, with , order by , clip by
Results of 1 - 10 of about 14 for Contact (0.005 sec.)
フォーム API 13951
フォーム API このドキュメントについて このドキュメントでは、Django のフォーム API の詳細について説明します。このドキュメントを読む前に フォームについての概要 を読むことをおすすめします。 バインドされた (bound) フォームとバインドされていない ... グできます。 class Form [ソース] バインドされていない Form のインスタンスを作成するには、クラスの初期化を行います。 >>> f = ContactForm () フォームにデータをバインドするには、辞書型のデータを Form クラスのコンストラクタの最初のパラメータとして渡します。 ... >>> data = { ... "subject" : "hello" , ... "message" : "Hi there" , ... "contact_email" : "foo@example.com" , ... "urgent" : True , ... } >>> f = ContactForm ( data ) この辞書では、キーは Form クラスの属 ... ンスと、されていないフォームインスタンスを区別する必要があるときは、フォームの is_bound 属性の値を確認してください。 >>> f = ContactForm () >>> f . is_bound False >>> f = ContactForm ({ "subject" : "hello" }) >>> f . is_bound True 空の辞書を渡すと、データ ...
https://man.mtool.work/django/6.1/ref/forms/api.html
ページ分割 (Pagination) 10870
ページ分割 (Pagination) Django は、ページ分割 (ページネーション) されたデータを管理するための高レベルと低レベルの方法を提供しています。つまり、"前へ/次へ" リンクを持つ、複数のページに分割されたデータです。 Paginator クラス 内部では、ページ分 ... by 属性をビュークラスに追加します。以下に例を示します。 from django.views.generic import ListView from myapp.models import Contact class ContactListView ( ListView ): paginate_by = 2 model = Contact これにより、各ページのオブジェクト数が制限され、 pagin ... ユーザーがページ間を移動できるように、次のようにしてテンプレートに次のページと前のページへのリンクを追加しましょう。 {% for contact in page_obj %} {# Each "contact" is a Contact model object. #} {{ contact.full_name | upper }} < br > ... {% endfor %} < d ... ator の一例です。 from django.core.paginator import Paginator from django.shortcuts import render from myapp.models import Contact def listing ( request ): contact_list = Contact . objects . all () paginator = Paginator ( contact_list , 25 ) # Show 25 c ...
https://man.mtool.work/django/6.1/topics/pagination.html
フォームを使う 10012
フォームを使う このドキュメントについて このドキュメントでは、Web フォームの基本と、それらを Django で扱う方法を紹介しています。より詳しく知りたいときは、フォーム API の特定の領域、 フォーム API 、 フォーム フィールド または フォームとフィー ... 用的なフォームを考えましょう。個人のウェブサイトで "お問い合わせ" 機能を実装します: forms.py from django import forms class ContactForm ( forms . Form ): subject = forms . CharField ( max_length = 100 ) message = forms . CharField ( widget = forms . Text ... area ) contact_email = forms . EmailField () urgent = forms . BooleanField ( required = False ) Our earlier form used a single field, you ... r_name , a CharField . In this case, our form has four fields: subject , message , contact_email and urgent . CharField , EmailField and BooleanField are just three of the available field types; a full list can be ...
https://man.mtool.work/django/6.1/topics/forms/
redirects (リダイレクト)アプリ 9575
redirects (リダイレクト)アプリ Django にはオプションで redirects (リダイレクト) アプリケーションが付属しています。リダイレクトをデータベースに保存し、リダイレクトを処理します。デフォルトでは HTTP 応答ステータスコード 301 Moved Permanently ... import Redirect >>> # Add a new redirect. >>> redirect = Redirect . objects . create ( ... site_id = 1 , ... old_path = "/contact-us/" , ... new_path = "/contact/" , ... ) >>> # Change a redirect. >>> redirect . new_path = "/contact-details/" >>> redir ... ect . save () >>> redirect <Redirect: /contact-us/ ---> /contact-details/> >>> # Delete a redirect. >>> Redirect . objects . filter ( site_id = 1 , old_path = "/contact- ...
https://man.mtool.work/django/6.1/ref/contrib/redirects.html
ジェネリック編集ビュー (Generic editing view) 8017
ジェネリック編集ビュー (Generic editing view) 以下のビューは、このページで説明され、内容を編集するための基礎を提供します: django.views.generic.edit.FormView django.views.generic.edit.CreateView django.views.generic.edit.UpdateView django.vi ... jango.views.generic.edit.ProcessFormView django.views.generic.base.View 例 myapp/forms.py : from django import forms class ContactForm ( forms . Form ): name = forms . CharField () message = forms . CharField ( widget = forms . Textarea ) def send_email ... ( self ): # send email using the self.cleaned_data dictionary pass 例 myapp/views.py : from myapp.forms import ContactForm from django.views.generic.edit import FormView class ContactFormView ( FormView ): template_name = "contact.html" form ... _class = ContactForm success_url = "/thanks/" def form_valid ( self , form ): # This method is called when valid form data has been POSTed. ...
https://man.mtool.work/django/6.1/ref/class-based-views/generic-editing.html
フォームとフィールドのバリデーション 7877
フォームとフィールドのバリデーション フォームのバリデーションは、データがクリーニング (clean) されるときに実行されます。このプロセスをカスタムしたい場合は、様々な箇所に変更を加えることができ、それぞれが違う目的を持っています。クリーニング方 ... 。これはこのタイプのフィールドに特有であり、それはこの後の使われ方には関係ありません。 このフィールドの使い方を示すために、 ContactForm を作成してみましょう: class ContactForm ( forms . Form ): subject = forms . CharField ( max_length = 100 ) message = f ... orms . CharField () contact_email = forms . EmailField () recipients = MultiEmailField () urgent = forms . BooleanField ( required = False ) MultiEmai ... メソッドを呼び出します。 特定のフィールド属性をクリーニングする Continuing on from the previous example, suppose that in our ContactForm , we want to make sure that the recipients field only contains addresses that are @example.com . This is validation th ...
https://man.mtool.work/django/6.1/ref/forms/validation.html
フォーム フィールド 7824
フォーム フィールド class Field [ソース] Form クラスを作成時の一番重要な部分は、form のフィールド (field) の定義です。各フィールドにはカスタムの検証ロジックがあり、他にいくつかのフックもあります。 Field. clean ( value ) [ソース] Field クラス ... ix Field. label_suffix label_suffix 引数を使用すると、フォームの label_suffix をフィールドごとに上書きできます。 >>> class ContactForm ( forms . Form ): ... age = forms . IntegerField () ... nationality = forms . CharField () ... captcha_answer = forms ... . IntegerField ( label = "2 + 2" , label_suffix = " =" ) ... >>> f = ContactForm ( label_suffix = "?" ) >>> print ( f ) <div><label for="id_age">Age?</label><input type="number" name="age" required i ... Form の完全な例です。出力を単純化するために auto_id=False を指定しています: >>> from django import forms >>> class HelpTextContactForm ( forms . Form ): ... subject = forms . CharField ( max_length = 100 , help_text = "100 characters max." ) ... message ...
https://man.mtool.work/django/6.1/ref/forms/fields.html
Submitting contributions 7772
Submitting contributions We're always grateful for contributions to Django's code. Indeed, bug reports with associated contributions will get fixed far more quickly than those without a solution. Typo fixes and trivial documentation changes ... able to be claimed. Otherwise, somebody else may be working on this ticket. Either find another bug/feature to work on, or contact the developer working on the ticket to offer your help. If a ticket has been assigned for weeks or months without any acti ...
https://man.mtool.work/django/6.1/internals/contributing/writing-code/submitting...
モデルフィールドリファレンス 7772
モデルフィールドリファレンス このドキュメントには、Django が提供するフィールドオプション field options とフィールド型 field types を含む、 Field のすべての API リファレンスが記載されています。 注釈 フィールドは django.db.models.fields に定義 ... オブジェクトでラップします。例えば、 JSONField に対してデフォルトの dict を指定したい場合、下記のような関数を使用します: def contact_default (): return { "email" : "to1@example.com" } contact_info = JSONField ( "ContactInfo" , default = contact_default ) ...
https://man.mtool.work/django/6.1/ref/models/fields.html
クラスベースのビューでフォームを扱う 7772
クラスベースのビューでフォームを扱う フォームの処理には、一般に3つの場合分けが存在します。 最初の GET リクエスト (空白またはデフォルト値が埋め込まれたフォームを返す) 無効なデータの POST リクエスト (よくあるパターンは、エラー表示を追加したフ ... を用意しています。 基本的なフォーム 以下のようなコンタクトフォームがあったとします。 forms.py from django import forms class ContactForm ( forms . Form ): name = forms . CharField () message = forms . CharField ( widget = forms . Textarea ) def send_email ... self.cleaned_data dictionary pass このとき、ビューは FormView を使うことで構築できます。 views.py from myapp.forms import ContactForm from django.views.generic.edit import FormView class ContactFormView ( FormView ): template_name = "contact.html" form ... _class = ContactForm success_url = "/thanks/" def form_valid ( self , form ): # This method is called when valid form data has been POSTed. ...
https://man.mtool.work/django/6.1/topics/class-based-views/generic-editing.html
PREV 1 2 NEXT