Changes between Version 3 and Version 4 of MagicRemovalCheatSheet
- Timestamp:
- May 11, 2006, 11:00:06 PM (19 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
MagicRemovalCheatSheet
v3 v4 56 56 * {{{django.core.extensions}}} => {{{django.shortcuts}}} 57 57 * '''renamed:''' {{{django.core.extensions.DjangoContext}}} => {{{django.template.RequestContext}}} 58 1. Former module {{{settings}}} is an instance now. [wiki:RemovingTheMagic#Movedsettingsintoaninstance Import it] using {{{from django.cong import settings}}}. 58 1. A former module {{{settings}}} is an instance now. [wiki:RemovingTheMagic#Movedsettingsintoaninstance Import it] using: 59 {{{ 60 from django.conf import settings 61 }}} 59 62 1. [wiki:RemovingTheMagic#Includetemplateextensionexplicitly Include template extensions explicitly]. 60 63 1. [wiki:RemovingTheMagic#Descriptorfields Convert to new Database API]. ''Warning: usually this is the most time-consuming step. Be careful!'' 61 64 1. [wiki:RemovingTheMagic#RenamedDoesNotExistexception Rename DoesNotExist exception]: {{{people.PersonDoesNotExist}}} becomes {{{Person.DoesNotExist}}}. 62 65 1. If you use {{{get_object_or_404()}}} and {{{get_list_or_404()}}}, [wiki:RemovingTheMagic#get_object_or_404andget_list_or_404nowtakemodelclassesnotmodules change their parameters]. Note: you cannot use ''field''{{{__ne}}} and {{{order_by}}} keywords. Use {{{exclude()}}} and {{{order_by()}}} methods of [wiki:RemovingTheMagic#Descriptorfields new Database API]. 66 1. If you call generic views from your views, [wiki:RemovingTheMagic#Changedtheparametersyoupasstogenericviews update their parameters]: remove {{{app_label}}} and {{{model_name}}}, add {{{queryset}}}. 63 67 1. If you use Django's authentication, [wiki:RemovingTheMagic#Authenticationhasbeenconsolidated update your code to reflect the consolidation]. 64 68 1. If you use manipulators, [wiki:RemovingTheMagic#Changedinterfacetomanipulators update your code]: {{{django.core.formfields}}} is {{{django.forms}}} now. 69 1. If you use raw database connections, [wiki:RemovingTheMagic#Databaseconnectionrelocated/renamed update your code]. 70 1. The {{{packages}}} module [wiki:RemovingTheMagic#Thepackagesmoduleisnomore has been removed]. 65 71 66 72 == Templates == 73 74 1. ''Optional (file consolidation):'' you can relocate your templates from {{{yourproject/templates/yourapp/}}} directory to {{{yourproject/yourapp/templates/}}} directory. 75 1. Template tags {{{extends}}} and {{{include}}} [wiki:RemovingTheMagic#Includetemplateextensionexplicitly should include template extensions explicitly]. 76 1. [wiki:RemovingTheMagic#Changedtemplatenamesingenericviews Change template names for generic views]: remove pluralization of model names. 77 1. If your template uses Django's methods defined on its parameters, try to move this code to corresponding views, if possible. Otherwise apply changes outlined in Views section above. 78 67 79 == Template tags == 68 80 == Settings and URLs ==