Code

Changes between Version 3 and Version 4 of MagicRemovalCheatSheet


Ignore:
Timestamp:
05/11/06 21:00:06 (8 years ago)
Author:
eugene@…
Comment:

added templates

Legend:

Unmodified
Added
Removed
Modified
  • MagicRemovalCheatSheet

    v3 v4  
    5656   * {{{django.core.extensions}}} => {{{django.shortcuts}}} 
    5757   * '''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{{{ 
     60from django.conf import settings 
     61}}} 
    5962 1. [wiki:RemovingTheMagic#Includetemplateextensionexplicitly Include template extensions explicitly]. 
    6063 1. [wiki:RemovingTheMagic#Descriptorfields Convert to new Database API]. ''Warning: usually this is the most time-consuming step. Be careful!'' 
    6164 1. [wiki:RemovingTheMagic#RenamedDoesNotExistexception Rename DoesNotExist exception]: {{{people.PersonDoesNotExist}}} becomes {{{Person.DoesNotExist}}}. 
    6265 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}}}. 
    6367 1. If you use Django's authentication, [wiki:RemovingTheMagic#Authenticationhasbeenconsolidated update your code to reflect the consolidation]. 
    6468 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]. 
    6571 
    6672== 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 
    6779== Template tags == 
    6880== Settings and URLs ==