... poll for voting" def add_arguments ( self , parser ): parser . add_argument ( "poll_ids" , nargs = "+" , type = int ) def handle ( self , * args , ** options ): for poll_id in options [ "poll_ids" ]: try : poll = Poll . objects . get ( pk = poll_id ) ... line" , ending = "" ) 新たに作成したカスタムコマンドは python manage.py closepoll <poll_ids> と実行する事で利用できます。 handle() メソッドは一つ以上の poll_ids を受け取り、それぞれに対応した poll.opened を False にセットします。もしコマンドの利用者が ... arguments parser . add_argument ( "--delete" , action = "store_true" , help = "Delete poll instead of closing it" , ) def handle ( self , * args , ** options ): # ... if options [ "delete" ]: poll . delete () # ... The option ( delete in our example) ... ... (most likely only Internet Explorer 6, and Internet Explorer 7 if run on Windows XP or Windows Server 2003) are unable to handle the Vary header in combination with many content types. Therefore, Django would remove the header if the request was made ... e browsers with more liberal URL parsing. To remedy this, the validation in is_safe_url() has been tightened to be able to handle and correctly validate these malformed URLs. ... ... (most likely only Internet Explorer 6, and Internet Explorer 7 if run on Windows XP or Windows Server 2003) are unable to handle the Vary header in combination with many content types. Therefore, Django would remove the header if the request was made ... e browsers with more liberal URL parsing. To remedy this, the validation in is_safe_url() has been tightened to be able to handle and correctly validate these malformed URLs. ... ... (most likely only Internet Explorer 6, and Internet Explorer 7 if run on Windows XP or Windows Server 2003) are unable to handle the Vary header in combination with many content types. Therefore, Django would remove the header if the request was made ... e browsers with more liberal URL parsing. To remedy this, the validation in is_safe_url() has been tightened to be able to handle and correctly validate these malformed URLs. バグ修正 Made the year_lookup_bounds_for_datetime_field Oracle backend method ... ... import HttpResponseRedirect from django.shortcuts import render from .forms import UploadFileForm # Imaginary function to handle an uploaded file. from somewhere import handle_uploaded_file def upload_file ( request ): if request . method == "POST" : ... form = UploadFileForm ( request . POST , request . FILES ) if form . is_valid (): handle_uploaded_file ( request . FILES [ "file" ]) return HttpResponseRedirect ( "/success/url/" ) else : form = UploadFileForm ( ... タに渡す必要があることに注意してください。 アップロードされたファイルをハンドルする一般的な方法は、次のようになります。 def handle_uploaded_file ( f ): with open ( "some/file/name.txt" , "wb+" ) as destination : for chunk in f . chunks (): destination . ... ... ... ... utility functions have been provided to ease interoperability with third-party libraries and systems which may or may not handle Unicode gracefully. Details are available in Django's Unicode-handling documentation. 詳しくは Unicode データ を参照。 改善 ... still exists and retains all of its previous functionality, but it is now built from two separate middleware classes which handle the two parts of caching (inserting into and reading from the cache) separately, offering additional flexibility for situa ... ... request)ビュー defaults. bad_request ( request , exception , template_name = '400.html' ) Similarly, Django has a view to handle 400 Bad Request errors. このビューは "Bad Request" メッセージを生成するか、ルートテンプレートディレクトリに作成された 400. ... faults.bad_request is triggered by a BadRequest exception. Also, when a SuspiciousOperation is raised in Django, it may be handled by a component of Django (for example resetting the session data). If not specifically handled, Django will consider the ... current request a 'bad request' instead of a server error, and handle it with bad_request . また、 bad_request ビューは DEBUG が False のときだけ使用されます。 ... ... rgument from your model fields. It is no longer necessary, since the equivalent functionality (part of inline editing ) is handled differently by the admin interface now. You don't have to worry about inline editing until you get to the admin section, ... as django.forms and django.oldforms ), you'll have to rewrite your forms. A good place to start is the forms documentation Handle uploaded files using the new API Replace use of uploaded files -- that is, entries in request.FILES -- as simple dictionar ... bly worth reading through the list and checking your code for these things. シグナル Add **kwargs to any registered signal handlers. Connect, disconnect, and send signals via methods on the Signal object instead of through module methods in django.disp ... 2026年10月08日