User Tools

Site Tools


devel:django_introduction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:django_introduction [2009/06/16 14:24]
jorabra Update path
devel:django_introduction [2010/01/13 11:30]
eide Add link to django_template blueprint
Line 18: Line 18:
 ==== URL configuration ==== ==== URL configuration ====
  
-In ''​nav.django.urls''​ the root URL configuration for all things ​Django in NAV is located''​nav.django.urls''​ is not only a module, but also a package. The ''​%%__init__.py%%''​ file in the package imports all submodules it can find in the file system, calls ''​get_urlpatterns()''​ on all the submodules, and combines the results into one ''​urlpatterns''​ list, as all Django URL configurations does.+The root URL configuration for all Django-related applications ​in NAV is located ​in ''​nav.django.urls''​. It is not only a module, but also a package. The ''​%%__init__.py%%''​ file in the package imports all submodules it can find in the directory, calls ''​get_urlpatterns()''​ on all the submodules, and combines the results into one ''​urlpatterns''​ list, as all Django URL configurations does.
  
 When creating a new Django app, create a new submodule for your app in the ''​subsystem/​your_app/​nav/​django/​urls/''​ folder, run ''​make install''​ in your app to install the module into the ''​nav.django.urls''​ package, and the NAV installation will find your app. If somebody else installs URLconf glue into ''​nav.django.urls''​ they will not affect the URL configuration for your app, unless they use exactly the same name for the submodule as you did. For details, check out the ''​ipdevinfo''​ subsystem and its ''​Makefile.in''​. When creating a new Django app, create a new submodule for your app in the ''​subsystem/​your_app/​nav/​django/​urls/''​ folder, run ''​make install''​ in your app to install the module into the ''​nav.django.urls''​ package, and the NAV installation will find your app. If somebody else installs URLconf glue into ''​nav.django.urls''​ they will not affect the URL configuration for your app, unless they use exactly the same name for the submodule as you did. For details, check out the ''​ipdevinfo''​ subsystem and its ''​Makefile.in''​.
Line 126: Line 126:
  
 As more parts of NAV are (re)implemented in Django, one should look into replacing the wrapping of Django templates in Cheetah templates with pure Django templates throughout the stack. Even if this may require maintenance of base templates in both Cheetah and Django for quite some time, it would result in much more flexibility with regard to page titles, bread crumb paths, etc. when using Django templates. As more parts of NAV are (re)implemented in Django, one should look into replacing the wrapping of Django templates in Cheetah templates with pure Django templates throughout the stack. Even if this may require maintenance of base templates in both Cheetah and Django for quite some time, it would result in much more flexibility with regard to page titles, bread crumb paths, etc. when using Django templates.
 +
 +Proposal in [[devel:​blueprints:​django_template]]
  
 ==== Unit testing ==== ==== Unit testing ====
devel/django_introduction.txt ยท Last modified: 2010/01/13 11:30 by eide