Ticket #14675: 14675-remove-import-star-from-urlconfs-5.patch

File 14675-remove-import-star-from-urlconfs-5.patch, 48.4 KB (added by Ramiro Morales, 13 years ago)

Updated patch

  • django/conf/project_template/urls.py

    diff --git a/django/conf/project_template/urls.py b/django/conf/project_template/urls.py
    a b  
    1 from django.conf.urls.defaults import patterns, include, url
     1from django.conf.urls import patterns, include, url
    22
    33# Uncomment the next two lines to enable the admin:
    44# from django.contrib import admin
  • django/conf/urls/__init__.py

    diff --git a/django/conf/urls/__init__.py b/django/conf/urls/__init__.py
    a b  
     1from django.conf.urls.defaults import (handler403, handler404, handler500,
     2        include, patterns, url)
  • django/conf/urls/defaults.py

    diff --git a/django/conf/urls/defaults.py b/django/conf/urls/defaults.py
    a b  
    44from django.utils.importlib import import_module
    55
    66
    7 __all__ = ['handler404', 'handler500', 'include', 'patterns', 'url']
     7__all__ = ['handler403', 'handler404', 'handler500', 'include', 'patterns', 'url']
    88
    99handler403 = 'django.views.defaults.permission_denied'
    1010handler404 = 'django.views.defaults.page_not_found'
  • django/conf/urls/i18n.py

    diff --git a/django/conf/urls/i18n.py b/django/conf/urls/i18n.py
    a b  
    11from django.conf import settings
    2 from django.conf.urls.defaults import patterns
     2from django.conf.urls import patterns
    33from django.core.urlresolvers import LocaleRegexURLResolver
    44
    55def i18n_patterns(prefix, *args):
  • django/conf/urls/shortcut.py

    diff --git a/django/conf/urls/shortcut.py b/django/conf/urls/shortcut.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22
    33urlpatterns = patterns('django.views',
    44    (r'^(?P<content_type_id>\d+)/(?P<object_id>.*)/$', 'defaults.shortcut'),
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    a b  
    320320        super(ModelAdmin, self).__init__()
    321321
    322322    def get_urls(self):
    323         from django.conf.urls.defaults import patterns, url
     323        from django.conf.urls import patterns, url
    324324
    325325        def wrap(view):
    326326            def wrapper(*args, **kwargs):
  • django/contrib/admin/sites.py

    diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
    a b  
    174174            class MyAdminSite(AdminSite):
    175175
    176176                def get_urls(self):
    177                     from django.conf.urls.defaults import patterns, url
     177                    from django.conf.urls import patterns, url
    178178
    179179                    urls = super(MyAdminSite, self).get_urls()
    180180                    urls += patterns('',
     
    199199        return update_wrapper(inner, view)
    200200
    201201    def get_urls(self):
    202         from django.conf.urls.defaults import patterns, url, include
     202        from django.conf.urls import patterns, url, include
    203203
    204204        if settings.DEBUG:
    205205            self.check_dependencies()
  • django/contrib/admindocs/urls.py

    diff --git a/django/contrib/admindocs/urls.py b/django/contrib/admindocs/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.contrib.admindocs import views
    33
    44urlpatterns = patterns('',
  • django/contrib/auth/admin.py

    diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
    a b  
    7474        return super(UserAdmin, self).get_form(request, obj, **defaults)
    7575
    7676    def get_urls(self):
    77         from django.conf.urls.defaults import patterns
     77        from django.conf.urls import patterns
    7878        return patterns('',
    7979            (r'^(\d+)/password/$', self.admin_site.admin_view(self.user_change_password))
    8080        ) + super(UserAdmin, self).get_urls()
  • django/contrib/auth/tests/urls.py

    diff --git a/django/contrib/auth/tests/urls.py b/django/contrib/auth/tests/urls.py
    a b  
    1 from django.conf.urls.defaults import patterns, url
     1from django.conf.urls import patterns, url
    22from django.contrib.auth import context_processors
    33from django.contrib.auth.urls import urlpatterns
    44from django.contrib.auth.views import password_reset
  • django/contrib/auth/urls.py

    diff --git a/django/contrib/auth/urls.py b/django/contrib/auth/urls.py
    a b  
    22# provided as a convenience to those who want to deploy these URLs elsewhere.
    33# This file is also used to provide a reliable view deployment for test purposes.
    44
    5 from django.conf.urls.defaults import *
     5from django.conf.urls import patterns
    66
    77urlpatterns = patterns('',
    88    (r'^login/$', 'django.contrib.auth.views.login'),
  • django/contrib/comments/urls.py

    diff --git a/django/contrib/comments/urls.py b/django/contrib/comments/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22
    33urlpatterns = patterns('django.contrib.comments.views',
    44    url(r'^post/$',          'comments.post_comment',       name='comments-post-comment'),
  • django/contrib/databrowse/urls.py

    diff --git a/django/contrib/databrowse/urls.py b/django/contrib/databrowse/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22from django.contrib.databrowse import views
    33
    44# Note: The views in this URLconf all require a 'models' argument,
  • django/contrib/flatpages/tests/urls.py

    diff --git a/django/contrib/flatpages/tests/urls.py b/django/contrib/flatpages/tests/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    22
    33# special urls for flatpage test cases
    44urlpatterns = patterns('',
  • django/contrib/flatpages/urls.py

    diff --git a/django/contrib/flatpages/urls.py b/django/contrib/flatpages/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22
    33urlpatterns = patterns('django.contrib.flatpages.views',
    44    (r'^(?P<url>.*)$', 'flatpage'),
  • django/contrib/formtools/tests/urls.py

    diff --git a/django/contrib/formtools/tests/urls.py b/django/contrib/formtools/tests/urls.py
    a b  
    22This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
    33"""
    44
    5 from django.conf.urls.defaults import *
     5from django.conf.urls import patterns, url
    66from django.contrib.formtools.tests import TestFormPreview, TestWizardClass
    77
    88from forms import (ContactWizard, Page1, Page2, Page3, TestForm,
  • django/contrib/formtools/tests/wizard/namedwizardtests/urls.py

    diff --git a/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py b/django/contrib/formtools/tests/wizard/namedwizardtests/urls.py
    a b  
    1 from django.conf.urls.defaults import patterns, url
     1from django.conf.urls import patterns, url
    22from django.contrib.formtools.tests.wizard.namedwizardtests.forms import (
    33    SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
    44
  • django/contrib/formtools/tests/wizard/wizardtests/urls.py

    diff --git a/django/contrib/formtools/tests/wizard/wizardtests/urls.py b/django/contrib/formtools/tests/wizard/wizardtests/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.contrib.formtools.tests.wizard.wizardtests.forms import (
    33    SessionContactWizard, CookieContactWizard, Page1, Page2, Page3, Page4)
    44
  • django/contrib/gis/tests/geoapp/urls.py

    diff --git a/django/contrib/gis/tests/geoapp/urls.py b/django/contrib/gis/tests/geoapp/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22from feeds import feed_dict
    33
    44urlpatterns = patterns('',
  • django/contrib/messages/tests/urls.py

    diff --git a/django/contrib/messages/tests/urls.py b/django/contrib/messages/tests/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22from django.contrib import messages
    33from django.core.urlresolvers import reverse
    44from django.http import HttpResponseRedirect, HttpResponse
  • django/contrib/sitemaps/tests/urls.py

    diff --git a/django/contrib/sitemaps/tests/urls.py b/django/contrib/sitemaps/tests/urls.py
    a b  
    11from datetime import datetime
    2 from django.conf.urls.defaults import *
     2from django.conf.urls import patterns
    33from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap
    44from django.contrib.auth.models import User
    55
  • docs/intro/overview.txt

    diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
    a b  
    176176Here's what a URLconf might look like for the ``Reporter``/``Article``
    177177example above::
    178178
    179     from django.conf.urls.defaults import *
     179    from django.conf.urls import patterns, url, include
    180180
    181181    urlpatterns = patterns('',
    182182        (r'^articles/(\d{4})/$', 'news.views.year_archive'),
  • docs/intro/tutorial02.txt

    diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt
    a b  
    4040
    4141      .. parsed-literal::
    4242
    43           from django.conf.urls.defaults import patterns, include, url
     43          from django.conf.urls import patterns, include, url
    4444
    4545          # Uncomment the next two lines to enable the admin:
    4646          **from django.contrib import admin**
  • docs/intro/tutorial03.txt

    diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
    a b  
    7878
    7979Time for an example. Edit ``mysite/urls.py`` so it looks like this::
    8080
    81     from django.conf.urls.defaults import patterns, include, url
     81    from django.conf.urls import patterns, include, url
    8282
    8383    from django.contrib import admin
    8484    admin.autodiscover()
     
    367367You normally won't have to bother with writing 404 views. By default, URLconfs
    368368have the following line up top::
    369369
    370     from django.conf.urls.defaults import patterns, include, url
     370    from django.conf.urls import patterns, include, url
    371371
    372372That takes care of setting ``handler404`` in the current module. As you can see
    373373in ``django/conf/urls/defaults.py``, ``handler404`` is set to
     
    443443
    444444Because this is a common case, the URLconf framework provides a shortcut for
    445445common prefixes. You can factor out the common prefixes and add them as the
    446 first argument to :func:`~django.conf.urls.defaults.patterns`, like so::
     446first argument to :func:`~django.conf.urls.patterns`, like so::
    447447
    448448    urlpatterns = patterns('polls.views',
    449449        (r'^polls/$', 'index'),
     
    457457
    458458Since you generally don't want the prefix for one app to be applied to every
    459459callback in your URLconf, you can concatenate multiple
    460 :func:`~django.conf.urls.defaults.patterns`. Your full ``mysite/urls.py`` might
     460:func:`~django.conf.urls.patterns`. Your full ``mysite/urls.py`` might
    461461now look like this::
    462462
    463     from django.conf.urls.defaults import patterns, include, url
     463    from django.conf.urls import patterns, include, url
    464464
    465465    from django.contrib import admin
    466466    admin.autodiscover()
    467    
     467
    468468    urlpatterns = patterns('polls.views',
    469469        (r'^polls/$', 'index'),
    470470        (r'^polls/(?P<poll_id>\d+)/$', 'detail'),
    471471        (r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
    472472        (r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
    473473    )
    474    
     474
    475475    urlpatterns += patterns('',
    476476        url(r'^admin/', include(admin.site.urls)),
    477477    )
     
    494494
    495495Copy the file ``mysite/urls.py`` to ``polls/urls.py``. Then, change
    496496``mysite/urls.py`` to remove the poll-specific URLs and insert an
    497 :func:`~django.conf.urls.defaults.include`, leaving you with::
     497:func:`~django.conf.urls.include`, leaving you with::
    498498
    499499    # This also imports the include function
    500     from django.conf.urls.defaults import patterns, include, url
    501    
     500    from django.conf.urls import patterns, include, url
     501
    502502    from django.contrib import admin
    503503    admin.autodiscover()
    504    
     504
    505505    urlpatterns = patterns('',
    506506        (r'^polls/', include('polls.urls')),
    507507        url(r'^admin/', include(admin.site.urls)),
    508508    )
    509509
    510 :func:`~django.conf.urls.defaults.include` simply references another URLconf.
     510:func:`~django.conf.urls.include` simply references another URLconf.
    511511Note that the regular expression doesn't have a ``$`` (end-of-string match
    512512character) but has the trailing slash. Whenever Django encounters
    513 :func:`~django.conf.urls.defaults.include`, it chops off whatever part of the
     513:func:`~django.conf.urls.include`, it chops off whatever part of the
    514514URL matched up to that point and sends the remaining string to the included
    515515URLconf for further processing.
    516516
     
    527527lines registering the admin site. Your ``polls/urls.py`` file should now look like
    528528this::
    529529
    530     from django.conf.urls.defaults import patterns, include, url
     530    from django.conf.urls import patterns, include, url
    531531
    532532    urlpatterns = patterns('polls.views',
    533533        (r'^$', 'index'),
     
    536536        (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
    537537    )
    538538
    539 The idea behind :func:`~django.conf.urls.defaults.include` and URLconf
     539The idea behind :func:`~django.conf.urls.include` and URLconf
    540540decoupling is to make it easy to plug-and-play URLs. Now that polls are in their
    541541own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or
    542542under "/content/polls/", or any other path root, and the app will still work.
  • docs/intro/tutorial04.txt

    diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt
    a b  
    218218First, open the ``polls/urls.py`` URLconf. It looks like this, according to the
    219219tutorial so far::
    220220
    221     from django.conf.urls.defaults import patterns, include, url
     221    from django.conf.urls import patterns, include, url
    222222
    223223    urlpatterns = patterns('polls.views',
    224224        (r'^$', 'index'),
     
    229229
    230230Change it like so::
    231231
    232     from django.conf.urls.defaults import patterns, include, url
     232    from django.conf.urls import patterns, include, url
    233233    from django.views.generic import DetailView, ListView
    234234    from polls.models import Poll
    235235
     
    269269      that we have a way to refer to its URL later on (see the
    270270      documentation about :ref:`naming URL patterns
    271271      <naming-url-patterns>` for information). We're also using the
    272       :func:`~django.conf.urls.default.url` function from
    273       :mod:`django.conf.urls.defaults` here. It's a good habit to use
    274       :func:`~django.conf.urls.defaults.url` when you are providing a
     272      :func:`~django.conf.urls.url` function from
     273      :mod:`django.conf.urls` here. It's a good habit to use
     274      :func:`~django.conf.urls.url` when you are providing a
    275275      pattern name like this.
    276276
    277277By default, the :class:`~django.views.generic.list.DetailView` generic
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    a b  
    18311831``django.contrib.admin.site`` at the URL ``/admin/`` ::
    18321832
    18331833    # urls.py
    1834     from django.conf.urls.defaults import *
     1834    from django.conf.urls import patterns, url, include
    18351835    from django.contrib import admin
    18361836
    18371837    admin.autodiscover()
     
    18471847``myproject.admin.admin_site`` at the URL ``/myadmin/`` ::
    18481848
    18491849    # urls.py
    1850     from django.conf.urls.defaults import *
     1850    from django.conf.urls import patterns, url, include
    18511851    from myproject.admin import admin_site
    18521852
    18531853    urlpatterns = patterns('',
     
    18711871respectively::
    18721872
    18731873    # urls.py
    1874     from django.conf.urls.defaults import *
     1874    from django.conf.urls import patterns, url, include
    18751875    from myproject.admin import basic_site, advanced_site
    18761876
    18771877    urlpatterns = patterns('',
  • docs/ref/contrib/comments/example.txt

    diff --git a/docs/ref/contrib/comments/example.txt b/docs/ref/contrib/comments/example.txt
    a b  
    143143
    144144.. code-block:: python
    145145
    146   from django.conf.urls.defaults import *
     146  from django.conf.urls import patterns, url, include
    147147  from django.contrib.comments.feeds import LatestCommentFeed
    148148
    149149  urlpatterns = patterns('',
     
    161161
    162162.. code-block:: python
    163163
    164     from django.conf.urls.defaults import *
     164    from django.conf.urls import patterns
    165165    from django.contrib.comments.feeds import LatestCommentFeed
    166166
    167167    feeds = {
  • docs/ref/contrib/formtools/form-wizard.txt

    diff --git a/docs/ref/contrib/formtools/form-wizard.txt b/docs/ref/contrib/formtools/form-wizard.txt
    a b  
    217217wizard's :meth:`as_view` method takes a list of your
    218218:class:`~django.forms.Form` classes as an argument during instantiation::
    219219
    220     from django.conf.urls.defaults import patterns
     220    from django.conf.urls import patterns
    221221
    222222    from myapp.forms import ContactForm1, ContactForm2
    223223    from myapp.views import ContactWizard
     
    525525
    526526We need to add the ``ContactWizard`` to our ``urls.py`` file::
    527527
    528     from django.conf.urls.defaults import pattern
     528    from django.conf.urls import pattern
    529529
    530530    from myapp.forms import ContactForm1, ContactForm2
    531531    from myapp.views import ContactWizard, show_message_form_condition
     
    572572
    573573Example code for the changed ``urls.py`` file::
    574574
    575     from django.conf.urls.defaults import url, patterns
     575    from django.conf.urls import url, patterns
    576576
    577577    from myapp.forms import ContactForm1, ContactForm2
    578578    from myapp.views import ContactWizard
  • docs/ref/contrib/gis/tutorial.txt

    diff --git a/docs/ref/contrib/gis/tutorial.txt b/docs/ref/contrib/gis/tutorial.txt
    a b  
    697697Next, edit your ``urls.py`` in the ``geodjango`` project folder to look
    698698as follows::
    699699
    700     from django.conf.urls.defaults import *
     700    from django.conf.urls import patterns, url, include
    701701    from django.contrib.gis import admin
    702702
    703703    admin.autodiscover()
  • docs/ref/contrib/sitemaps.txt

    diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt
    a b  
    241241
    242242Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
    243243
    244     from django.conf.urls.defaults import *
     244    from django.conf.urls import patterns, url, include
    245245    from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
    246246    from blog.models import Entry
    247247
  • docs/ref/contrib/syndication.txt

    diff --git a/docs/ref/contrib/syndication.txt b/docs/ref/contrib/syndication.txt
    a b  
    8080To connect a URL to this feed, put an instance of the Feed object in
    8181your :doc:`URLconf </topics/http/urls>`. For example::
    8282
    83     from django.conf.urls.defaults import *
     83    from django.conf.urls import patterns, url, include
    8484    from myproject.feeds import LatestEntriesFeed
    8585
    8686    urlpatterns = patterns('',
     
    327327
    328328And the accompanying URLconf::
    329329
    330     from django.conf.urls.defaults import *
     330    from django.conf.urls import patterns, url, include
    331331    from myproject.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
    332332
    333333    urlpatterns = patterns('',
  • docs/ref/models/instances.txt

    diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
    a b  
    524524rather than the view function. A named URL pattern is defined by replacing the
    525525pattern tuple by a call to the ``url`` function)::
    526526
    527     from django.conf.urls.defaults import *
     527    from django.conf.urls import patterns, url, include
    528528
    529529    url(r'^people/(\d+)/$', 'blog_views.generic_detail', name='people_view'),
    530530
  • docs/releases/1.4.txt

    diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt
    a b  
    290290  MySQL with the InnoDB database engine.
    291291
    292292* A new 403 response handler has been added as
    293   ``'django.views.defaults.permission_denied'``. See the documentation
    294   about :ref:`the 403 (HTTP Forbidden) view<http_forbidden_view>` for more
    295   information.
     293  ``'django.views.defaults.permission_denied'``. You can set your own handler by
     294  setting the value of :data:`django.conf.urls.handler403`. See the
     295  documentation about :ref:`the 403 (HTTP Forbidden) view<http_forbidden_view>`
     296  for more information.
    296297
    297298* The :ttag:`trans` template tag now takes an optional ``as`` argument to
    298299  be able to retrieve a translation string without displaying it but setting
     
    590591
    591592The existence of any ``'filters'`` key under the ``'mail_admins'`` handler will
    592593disable this backward-compatibility shim and deprecation warning.
     594
     595``django.conf.urls.defaults``
     596~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     597
     598Until Django 1.3 the functions :func:`~django.conf.urls.include`,
     599:func:`~django.conf.urls.patterns` and :func:`~django.conf.urls.url` plus
     600:data:`~django.conf.urls.handler404`, :data:`~django.conf.urls.handler500`
     601were located in a ``django.conf.urls.defaults`` module.
     602
     603Starting with Django 1.4 they are now available in :mod:`django.conf.urls`.
  • docs/topics/class-based-views.txt

    diff --git a/docs/topics/class-based-views.txt b/docs/topics/class-based-views.txt
    a b  
    7575instead, which is the entry point for class-based views::
    7676
    7777    # urls.py
    78     from django.conf.urls.defaults import *
     78    from django.conf.urls import patterns, url, include
    7979    from some_app.views import AboutView
    8080
    8181    urlpatterns = patterns('',
     
    8686class-based view, you can simply pass the new attributes into the ``as_view``
    8787method call itself::
    8888
    89     from django.conf.urls.defaults import *
     89    from django.conf.urls import patterns, url, include
    9090    from django.views.generic import TemplateView
    9191
    9292    urlpatterns = patterns('',
     
    135135
    136136To build a list page of all publishers, we'd use a URLconf along these lines::
    137137
    138     from django.conf.urls.defaults import *
     138    from django.conf.urls import patterns, url, include
    139139    from django.views.generic import ListView
    140140    from books.models import Publisher
    141141
  • docs/topics/generic-views.txt

    diff --git a/docs/topics/generic-views.txt b/docs/topics/generic-views.txt
    a b  
    5858For example, here's a simple URLconf you could use to present a static "about"
    5959page::
    6060
    61     from django.conf.urls.defaults import *
     61    from django.conf.urls import patterns, url, include
    6262    from django.views.generic.simple import direct_to_template
    6363
    6464    urlpatterns = patterns('',
     
    8080
    8181.. parsed-literal::
    8282
    83     from django.conf.urls.defaults import *
     83    from django.conf.urls import patterns, url, include
    8484    from django.views.generic.simple import direct_to_template
    8585    **from books.views import about_pages**
    8686
     
    160160
    161161To build a list page of all publishers, we'd use a URLconf along these lines::
    162162
    163     from django.conf.urls.defaults import *
     163    from django.conf.urls import patterns, url, include
    164164    from django.views.generic import list_detail
    165165    from books.models import Publisher
    166166
  • docs/topics/http/urls.txt

    diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt
    a b  
    5050
    5151    2. Django loads that Python module and looks for the variable
    5252       ``urlpatterns``. This should be a Python list, in the format returned by
    53        the function :func:`django.conf.urls.defaults.patterns`.
     53       the function :func:`django.conf.urls.patterns`.
    5454
    5555    3. Django runs through each URL pattern, in order, and stops at the first
    5656       one that matches the requested URL.
     
    6969
    7070Here's a sample URLconf::
    7171
    72     from django.conf.urls.defaults import *
     72    from django.conf.urls import patterns, url, include
    7373
    7474    urlpatterns = patterns('',
    7575        (r'^articles/2003/$', 'news.views.special_case_2003'),
     
    8080
    8181Notes:
    8282
    83     * ``from django.conf.urls.defaults import *`` makes the ``patterns()``
    84       function available.
    85 
    8683    * To capture a value from the URL, just put parenthesis around it.
    8784
    8885    * There's no need to add a leading slash, because every URL has that. For
     
    184181==================================
    185182
    186183``urlpatterns`` should be a Python list, in the format returned by the function
    187 :func:`django.conf.urls.defaults.patterns`. Always use ``patterns()`` to create
     184:func:`django.conf.urls.patterns`. Always use ``patterns()`` to create
    188185the ``urlpatterns`` variable.
    189186
    190 Convention is to use ``from django.conf.urls.defaults import *`` at the top of
    191 your URLconf. This gives your module access to these objects:
     187``django.conf.urls`` also defines some other functions you'll want to use:
    192188
    193 .. module:: django.conf.urls.defaults
     189.. module:: django.conf.urls
     190
     191.. versionchanged:: 1.4
     192    Starting with Django 1.4 `functions `patterns``, ``url``, ``include`` plus
     193    the ``handler*`` symbols described below are now available in the
     194    ``django.conf.urls`` module.
     195
     196    Until Django 1.3 they were located in ``django.conf.urls.defaults``. For
     197    the time being you still can import them from there.
    194198
    195199patterns
    196200--------
     
    281285See the documentation on :ref:`customizing error views
    282286<customizing-error-views>` for more details.
    283287
     288handler403
     289----------
     290
     291.. data:: handler403
     292
     293A callable, or a string representing the full Python import path to the view
     294that should be called if the user has no the permissions required to access
     295a resource.
     296
     297By default, this is ``'django.views.defaults.permission_denied'``. That default
     298value should suffice.
     299
     300See the documentation about :ref:`the 403 (HTTP Forbidden) view
     301<http_forbidden_view>` for more information.
     302
     303.. versionadded:: 1.4
     304    ``handler403`` is new in Django 1.4.
     305
    284306handler404
    285307----------
    286308
     
    355377
    356378Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
    357379
    358     from django.conf.urls.defaults import *
     380    from django.conf.urls import patterns, url, include
    359381
    360382    urlpatterns = patterns('',
    361383        (r'^articles/(\d{4})/$', 'news.views.year_archive'),
     
    370392
    371393With this in mind, the above example can be written more concisely as::
    372394
    373     from django.conf.urls.defaults import *
     395    from django.conf.urls import patterns, url, include
    374396
    375397    urlpatterns = patterns('news.views',
    376398        (r'^articles/(\d{4})/$', 'year_archive'),
     
    391413
    392414Old::
    393415
    394     from django.conf.urls.defaults import *
     416    from django.conf.urls import patterns, url, include
    395417
    396418    urlpatterns = patterns('',
    397419        (r'^$', 'django.views.generic.date_based.archive_index'),
     
    401423
    402424New::
    403425
    404     from django.conf.urls.defaults import *
     426    from django.conf.urls import patterns, url, include
    405427
    406428    urlpatterns = patterns('django.views.generic.date_based',
    407429        (r'^$', 'archive_index'),
     
    421443For example, here's the URLconf for the `Django Web site`_ itself. It includes a
    422444number of other URLconfs::
    423445
    424     from django.conf.urls.defaults import *
     446    from django.conf.urls import patterns, url, include
    425447
    426448    urlpatterns = patterns('',
    427449        (r'^weblog/',        include('django_website.apps.blog.urls.blog')),
     
    439461URLconf Python module defining them as the `include`_ argument but by using
    440462directly the pattern list as returned by `patterns`_ instead. For example::
    441463
    442     from django.conf.urls.defaults import *
     464    from django.conf.urls import patterns, url, include
    443465
    444466    extra_patterns = patterns('',
    445467        url(r'reports/(?P<id>\d+)/$', 'credit.views.report', name='credit-reports'),
  • docs/topics/i18n/internationalization.txt

    diff --git a/docs/topics/i18n/internationalization.txt b/docs/topics/i18n/internationalization.txt
    a b  
    819819.. function:: i18n_patterns(prefix, pattern_description, ...)
    820820
    821821This function can be used in your root URLconf as a replacement for the normal
    822 :func:`django.conf.urls.defaults.patterns` function. Django will automatically
     822:func:`django.conf.urls.patterns` function. Django will automatically
    823823prepend the current active language code to all url patterns defined within
    824824:func:`~django.conf.urls.i18n.i18n_patterns`. Example URL patterns::
    825825
    826     from django.conf.urls.defaults import patterns, include, url
     826    from django.conf.urls import patterns, include, url
    827827    from django.conf.urls.i18n import i18n_patterns
    828828
    829829    urlpatterns = patterns(''
     
    877877URL patterns can also be marked translatable using the
    878878:func:`~django.utils.translation.ugettext_lazy` function. Example::
    879879
    880     from django.conf.urls.defaults import patterns, include, url
     880    from django.conf.urls import patterns, include, url
    881881    from django.conf.urls.i18n import i18n_patterns
    882882    from django.utils.translation import ugettext_lazy as _
    883883
  • tests/modeltests/test_client/urls.py

    diff --git a/tests/modeltests/test_client/urls.py b/tests/modeltests/test_client/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22from django.views.generic import RedirectView
    33import views
    44
  • tests/regressiontests/admin_views/customadmin.py

    diff --git a/tests/regressiontests/admin_views/customadmin.py b/tests/regressiontests/admin_views/customadmin.py
    a b  
    11"""
    22A second, custom AdminSite -- see tests.CustomAdminSiteTests.
    33"""
    4 from django.conf.urls.defaults import patterns
     4from django.conf.urls import patterns
    55from django.contrib import admin
    66from django.http import HttpResponse
    77
  • tests/regressiontests/admin_views/urls.py

    diff --git a/tests/regressiontests/admin_views/urls.py b/tests/regressiontests/admin_views/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    22from django.contrib import admin
    33import views
    44import customadmin
  • tests/regressiontests/admin_widgets/urls.py

    diff --git a/tests/regressiontests/admin_widgets/urls.py b/tests/regressiontests/admin_widgets/urls.py
    a b  
    1 
    2 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    32import widgetadmin
    43
    54urlpatterns = patterns('',
  • tests/regressiontests/comment_tests/urls.py

    diff --git a/tests/regressiontests/comment_tests/urls.py b/tests/regressiontests/comment_tests/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.contrib.comments.feeds import LatestCommentFeed
    33
    44feeds = {
  • tests/regressiontests/comment_tests/urls_admin.py

    diff --git a/tests/regressiontests/comment_tests/urls_admin.py b/tests/regressiontests/comment_tests/urls_admin.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    22from django.contrib import admin
    33from django.contrib.comments.admin import CommentsAdmin
    44from django.contrib.comments.models import Comment
  • tests/regressiontests/conditional_processing/urls.py

    diff --git a/tests/regressiontests/conditional_processing/urls.py b/tests/regressiontests/conditional_processing/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22import views
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/context_processors/urls.py

    diff --git a/tests/regressiontests/context_processors/urls.py b/tests/regressiontests/context_processors/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22
    33import views
    44
  • tests/regressiontests/file_uploads/urls.py

    diff --git a/tests/regressiontests/file_uploads/urls.py b/tests/regressiontests/file_uploads/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22import views
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/generic_inline_admin/urls.py

    diff --git a/tests/regressiontests/generic_inline_admin/urls.py b/tests/regressiontests/generic_inline_admin/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    22from django.contrib import admin
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/generic_views/urls.py

    diff --git a/tests/regressiontests/generic_views/urls.py b/tests/regressiontests/generic_views/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.views.generic import TemplateView
    33from django.views.decorators.cache import cache_page
    44
  • tests/regressiontests/i18n/patterns/urls/default.py

    diff --git a/tests/regressiontests/i18n/patterns/urls/default.py b/tests/regressiontests/i18n/patterns/urls/default.py
    a b  
    1 from django.conf.urls.defaults import patterns, include, url
     1from django.conf.urls import patterns, include, url
    22from django.conf.urls.i18n import i18n_patterns
    33from django.utils.translation import ugettext_lazy as _
    44from django.views.generic import TemplateView
  • tests/regressiontests/i18n/patterns/urls/disabled.py

    diff --git a/tests/regressiontests/i18n/patterns/urls/disabled.py b/tests/regressiontests/i18n/patterns/urls/disabled.py
    a b  
    1 from django.conf.urls.defaults import url
     1from django.conf.urls import url
    22from django.conf.urls.i18n import i18n_patterns
    33from django.views.generic import TemplateView
    44
  • tests/regressiontests/i18n/patterns/urls/namespace.py

    diff --git a/tests/regressiontests/i18n/patterns/urls/namespace.py b/tests/regressiontests/i18n/patterns/urls/namespace.py
    a b  
    1 from django.conf.urls.defaults import patterns, url
     1from django.conf.urls import patterns, url
    22from django.utils.translation import ugettext_lazy as _
    33from django.views.generic import TemplateView
    44
  • tests/regressiontests/i18n/patterns/urls/wrong.py

    diff --git a/tests/regressiontests/i18n/patterns/urls/wrong.py b/tests/regressiontests/i18n/patterns/urls/wrong.py
    a b  
    1 from django.conf.urls.defaults import include, url
     1from django.conf.urls import include, url
    22from django.conf.urls.i18n import i18n_patterns
    33from django.utils.translation import ugettext_lazy as _
    44
  • tests/regressiontests/i18n/patterns/urls/wrong_namespace.py

    diff --git a/tests/regressiontests/i18n/patterns/urls/wrong_namespace.py b/tests/regressiontests/i18n/patterns/urls/wrong_namespace.py
    a b  
    1 from django.conf.urls.defaults import url
     1from django.conf.urls import url
    22from django.conf.urls.i18n import i18n_patterns
    33from django.utils.translation import ugettext_lazy as _
    44from django.views.generic import TemplateView
  • tests/regressiontests/middleware/cond_get_urls.py

    diff --git a/tests/regressiontests/middleware/cond_get_urls.py b/tests/regressiontests/middleware/cond_get_urls.py
    a b  
    1 from django.conf.urls.defaults import patterns
     1from django.conf.urls import patterns
    22from django.http import HttpResponse
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/middleware/extra_urls.py

    diff --git a/tests/regressiontests/middleware/extra_urls.py b/tests/regressiontests/middleware/extra_urls.py
    a b  
    1 from django.conf.urls.defaults import patterns
     1from django.conf.urls import patterns
    22
    33urlpatterns = patterns('',
    44    (r'^middleware/customurlconf/noslash$', 'view'),
  • tests/regressiontests/middleware/urls.py

    diff --git a/tests/regressiontests/middleware/urls.py b/tests/regressiontests/middleware/urls.py
    a b  
    1 from django.conf.urls.defaults import patterns
     1from django.conf.urls import patterns
    22
    33urlpatterns = patterns('',
    44    (r'^noslash$', 'view'),
  • tests/regressiontests/middleware_exceptions/urls.py

    diff --git a/tests/regressiontests/middleware_exceptions/urls.py b/tests/regressiontests/middleware_exceptions/urls.py
    a b  
    11# coding: utf-8
    2 from django.conf.urls.defaults import *
     2from django.conf.urls import patterns
    33
    44import views
    55
  • tests/regressiontests/model_permalink/urls.py

    diff --git a/tests/regressiontests/model_permalink/urls.py b/tests/regressiontests/model_permalink/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22
    33urlpatterns = patterns('',
    44    url(r'^guitarists/(\w{1,50})/$', 'unimplemented_view_placeholder', name='guitarist_detail'),
  • tests/regressiontests/special_headers/urls.py

    diff --git a/tests/regressiontests/special_headers/urls.py b/tests/regressiontests/special_headers/urls.py
    a b  
    11# coding: utf-8
    2 from django.conf.urls.defaults import *
     2from django.conf.urls import patterns
    33from django.views.generic.list_detail import object_detail
    44from models import Article
    55import views
  • tests/regressiontests/staticfiles_tests/urls/default.py

    diff --git a/tests/regressiontests/staticfiles_tests/urls/default.py b/tests/regressiontests/staticfiles_tests/urls/default.py
    a b  
    1 from django.conf.urls.defaults import patterns, url
     1from django.conf.urls import patterns, url
    22
    33urlpatterns = patterns('',
    44    url(r'^static/(?P<path>.*)$', 'django.contrib.staticfiles.views.serve'),
  • tests/regressiontests/syndication/urls.py

    diff --git a/tests/regressiontests/syndication/urls.py b/tests/regressiontests/syndication/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns
    22
    33import feeds
    44
  • tests/regressiontests/templates/alternate_urls.py

    diff --git a/tests/regressiontests/templates/alternate_urls.py b/tests/regressiontests/templates/alternate_urls.py
    a b  
    11# coding: utf-8
    2 from django.conf.urls.defaults import *
     2from django.conf.urls import patterns, url
    33
    44from regressiontests.templates import views
    55
  • tests/regressiontests/templates/urls.py

    diff --git a/tests/regressiontests/templates/urls.py b/tests/regressiontests/templates/urls.py
    a b  
    11# coding: utf-8
    2 from django.conf.urls.defaults import *
     2from django.conf.urls import patterns, url
    33from regressiontests.templates import views
    44
    55urlpatterns = patterns('',
  • tests/regressiontests/test_client_regress/urls.py

    diff --git a/tests/regressiontests/test_client_regress/urls.py b/tests/regressiontests/test_client_regress/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.views.generic import RedirectView
    33import views
    44
  • tests/regressiontests/test_utils/urls.py

    diff --git a/tests/regressiontests/test_utils/urls.py b/tests/regressiontests/test_utils/urls.py
    a b  
    1 from django.conf.urls.defaults import patterns
     1from django.conf.urls import patterns
    22
    33import views
    44
  • tests/regressiontests/urlpatterns_reverse/erroneous_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/erroneous_urls.py b/tests/regressiontests/urlpatterns_reverse/erroneous_urls.py
    a b  
    1 from django.conf.urls.defaults import patterns, url
     1from django.conf.urls import patterns, url
    22
    33urlpatterns = patterns('',
    44    # View has erroneous import
  • tests/regressiontests/urlpatterns_reverse/extra_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/extra_urls.py b/tests/regressiontests/urlpatterns_reverse/extra_urls.py
    a b  
    22Some extra URL patterns that are included at the top level.
    33"""
    44
    5 from django.conf.urls.defaults import *
     5from django.conf.urls import patterns, url, include
    66from views import empty_view
    77
    88urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/included_named_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/included_named_urls.py b/tests/regressiontests/urlpatterns_reverse/included_named_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22from views import empty_view
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/included_named_urls2.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/included_named_urls2.py b/tests/regressiontests/urlpatterns_reverse/included_named_urls2.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from views import empty_view
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/included_namespace_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/included_namespace_urls.py b/tests/regressiontests/urlpatterns_reverse/included_namespace_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22from namespace_urls import URLObject
    33from views import view_class_instance
    44
  • tests/regressiontests/urlpatterns_reverse/included_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/included_urls.py b/tests/regressiontests/urlpatterns_reverse/included_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from views import empty_view
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/included_urls2.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/included_urls2.py b/tests/regressiontests/urlpatterns_reverse/included_urls2.py
    a b  
    55argument list.
    66"""
    77
    8 from django.conf.urls.defaults import *
     8from django.conf.urls import patterns, url
    99from views import empty_view
    1010
    1111urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/named_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/named_urls.py b/tests/regressiontests/urlpatterns_reverse/named_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22from views import empty_view
    33
    44urlpatterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/namespace_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/namespace_urls.py b/tests/regressiontests/urlpatterns_reverse/namespace_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22from views import view_class_instance
    33
    44class URLObject(object):
  • tests/regressiontests/urlpatterns_reverse/no_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/no_urls.py b/tests/regressiontests/urlpatterns_reverse/no_urls.py
    a b  
    1 #from django.conf.urls.defaults import *
     1#from django.conf.urls import patterns, url, include
    22
  • tests/regressiontests/urlpatterns_reverse/reverse_lazy_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/reverse_lazy_urls.py b/tests/regressiontests/urlpatterns_reverse/reverse_lazy_urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22
    33from views import empty_view, LazyRedirectView, login_required_view
    44
  • tests/regressiontests/urlpatterns_reverse/urlconf_inner.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urlconf_inner.py b/tests/regressiontests/urlpatterns_reverse/urlconf_inner.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url
    22from django.template import Template, Context
    33from django.http import HttpResponse
    44
  • tests/regressiontests/urlpatterns_reverse/urlconf_outer.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urlconf_outer.py b/tests/regressiontests/urlpatterns_reverse/urlconf_outer.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22
    33import urlconf_inner
    44
  • tests/regressiontests/urlpatterns_reverse/urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urls.py b/tests/regressiontests/urlpatterns_reverse/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, url, include
    22from views import empty_view, absolute_kwargs_view
    33
    44other_patterns = patterns('',
  • tests/regressiontests/urlpatterns_reverse/urls_error_handlers.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urls_error_handlers.py b/tests/regressiontests/urlpatterns_reverse/urls_error_handlers.py
    a b  
    11# Used by the ErrorHandlerResolutionTests test case.
    22
    3 from django.conf.urls.defaults import patterns
     3from django.conf.urls import patterns
    44
    55urlpatterns = patterns('')
    66
  • tests/regressiontests/urlpatterns_reverse/urls_error_handlers_callables.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urls_error_handlers_callables.py b/tests/regressiontests/urlpatterns_reverse/urls_error_handlers_callables.py
    a b  
    11# Used by the ErrorHandlerResolutionTests test case.
    22
    3 from django.conf.urls.defaults import patterns
     3from django.conf.urls import patterns
    44from views import empty_view
    55
    66urlpatterns = patterns('')
  • tests/regressiontests/urlpatterns_reverse/urls_without_full_import.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/urls_without_full_import.py b/tests/regressiontests/urlpatterns_reverse/urls_without_full_import.py
    a b  
    11# A URLs file that doesn't use the default
    2 # from django.conf.urls.defaults import *
     2# from django.conf.urls import *
    33# import pattern.
    4 from django.conf.urls.defaults import patterns, url
     4from django.conf.urls import patterns, url
    55from views import empty_view, bad_view
    66
    77urlpatterns = patterns('',
  • tests/regressiontests/views/generic_urls.py

    diff --git a/tests/regressiontests/views/generic_urls.py b/tests/regressiontests/views/generic_urls.py
    a b  
    11# -*- coding:utf-8 -*-
    2 from django.conf.urls.defaults import patterns, url
     2from django.conf.urls import patterns, url
    33
    44from models import *
    55
  • tests/regressiontests/views/urls.py

    diff --git a/tests/regressiontests/views/urls.py b/tests/regressiontests/views/urls.py
    a b  
    11# coding: utf-8
    22from os import path
    33
    4 from django.conf.urls.defaults import *
     4from django.conf.urls import patterns, url, include
    55
    66import views
    77
  • tests/urls.py

    diff --git a/tests/urls.py b/tests/urls.py
    a b  
    1 from django.conf.urls.defaults import *
     1from django.conf.urls import patterns, include
    22
    33
    44urlpatterns = patterns('',
Back to Top