... users . using ( priority = 10 ) . priority 10 Enqueueing Tasks To add the Task to the queue store, so it will be executed, call the enqueue() method on it. If the Task takes arguments, these can be passed as-is. For example: result = email_users . en ... serialized to JSON, they must be JSON-serializable: >>> process_data . enqueue ( datetime . now ()) Traceback (most recent call last): ... TypeError : Object of type datetime is not JSON serializable Arguments must also be able to round-trip through ... ctionary . enqueue (( 1 , 2 , 3 )) >>> result . status FAILED >>> result . errors [ 0 ] . traceback Traceback (most recent call last): ... TypeError : unhashable type: 'list' The double_dictionary Task fails because after the JSON round-trip the tupl ... ... None , ** kwargs ): super () . __init__ ( ** kwargs ) self . min = min self . max = max def check ( self , ** kwargs ): # Call the superclass errors = super () . check ( ** kwargs ) # Do some custom checks and add messages to `errors`: errors . exte ... み込み時には特定のチェックを登録する必要があるため、システムチェックフレームワーク内での統合をテストするのが便利です。これは call_command() 関数を使うことで実現できます。 例えば、このテストは SITE_ID の設定が整数でなければならないことを示しています。こ ... れは組み込みの サイト フレームワークからのチェック のものです: from django.core.management import call_command from django.core.management.base import SystemCheckError from django.test import SimpleTestCase , modify_settings ... ... hell django-admin shell Python のインタラクティブ・インタープリタを開始します。 All models from installed apps are automatically imported into the shell environment. Models from apps listed earlier in INSTALLED_APPS take precedence. The following com ... , models from django.conf import settings from django.utils import timezone For a --verbosity of 2 or higher, the automatically imported objects will be listed. To disable automatic importing entirely, use the --no-imports flag. See the guide on cus ... -buffer オプション と同じように、テストに合格した出力 ( stdout と stderr ) を破棄します。 --no-faulthandler Django automatically calls faulthandler.enable() when starting the tests, which allows it to print a traceback if the interpreter crashes. Pas ... ... e PostGIS 2 CREATE EXTENSION postgis and the SpatiaLite SELECT InitSpatialMetaData initialization commands are now automatically run by migrate . The GDAL interface now supports retrieving properties of raster (image) data file . Compatibility shims ... ds compatibility but should not be used any longer. django.contrib.sessions Session cookie is now deleted after flush() is called. django.contrib.sitemaps The new Sitemap.i18n attribute allows you to generate a sitemap based on the LANGUAGES setting. ... nger creates explicit indexes for foreign keys when using the InnoDB storage engine, as MySQL already creates them automatically. The Oracle backend no longer defines the connection_persists_old_columns feature as True . Instead, Oracle will now incl ... ... l.save() now accepts an update_fields argument, letting you specify which fields are written back to the database when you call save() . This can help in high-concurrency operations, and can improve performance. Better support for streaming responses ... support, and Django 1.5 supports that alpha release. Python 3 support Django 1.5 introduces support for Python 3 - specifically, Python 3.2 and above. This comes in the form of a single codebase; you don't need to install a different version of Djan ... hen trying to avoid overwriting concurrent changes. Deferred instances (those loaded by .only() or .defer() ) will automatically save just the loaded fields. If any field is set manually after load, that field will also get updated on save. See the M ... ... er sending features. During development or testing you often don't want to send email at all. Django's test runner automatically overrides the MAILERS configuration to substitute Django's memory email backend . This prevents test cases from sending r ... ow raises a TypeError . send_mass_mail() と send_mail() の比較 The main difference between send_mass_mail() and repeatedly calling send_mail() is that send_mail() opens a connection to the mail server each time it's executed, while send_mass_mail() u ... essage class is initialized with the following parameters. All parameters are optional and can be set at any time prior to calling the send() method. The first four parameters can be passed as positional or keyword arguments, but must be in the given ... ... ( Lower ( "headline" ) . desc ()) If you don't want any ordering to be applied to a query, not even the default ordering, call order_by() with no parameters. クエリに並び替えが適用されたかどうかは、 QuerySet.ordered 属性を確認することで知ることができ ... L で効率的に行うことができないため、Django ではサポートされていません。 Also, note that reverse() should generally only be called on a QuerySet which has a defined ordering (e.g., when querying against a model which defines a default ordering, or whe ... n using order_by() ). If no such ordering is defined for a given QuerySet , calling reverse() on it has no real effect (the ordering was undefined prior to calling reverse() , and will remain undefined a ... ... >> page2 . has_previous () True >>> page2 . has_other_pages () True >>> page2 . next_page_number () Traceback (most recent call last): ... EmptyPage : That page contains no results >>> page2 . previous_page_number () 1 >>> page2 . start_index () # Th ... e 3 >>> page2 . end_index () # The 1-based index of the last item on this page 4 >>> p . page ( 0 ) Traceback (most recent call last): ... EmptyPage : That page number is less than 1 >>> p . page ( 3 ) Traceback (most recent call last): ... EmptyPage ... ... tom tools in this case. The LogEntry model now stores change messages in a JSON structure so that the message can be dynamically translated using the current active language. A new LogEntry.get_change_message() method is now the preferred way of retr ... erwise. The new Storage.generate_filename() method makes it easier to implement custom storages that don't use the os.path calls previously in FileField . フォーム Form and widget Media is now served using django.contrib.staticfiles if installed. The ... angojs translation domain from all installed apps rather than only the JavaScript strings from LOCALE_PATHS . 管理コマンド call_command() now returns the value returned from the command.handle() method. The new check --fail-level option allows specif ... ... e_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. # It should return an HttpResponse. form . send_email () return super () . form_va ... トするというものです。 モデルフォーム Generic views really shine when working with models. These generic views will automatically create a ModelForm , so long as they can work out which model class to use: model 属性が与えられた場合には、そのモデルクラ ... エリセットに対するモデルが使用されます。 Model form views provide a form_valid() implementation that saves the model automatically. You can override this if you have any special requirements; see below for examples. You don't even need to provide a suc ... 2026年10月08日