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

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

Patch updated to apply cleanly as of now

  • 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 *
  • 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  
    319319        super(ModelAdmin, self).__init__()
    320320
    321321    def get_urls(self):
    322         from django.conf.urls.defaults import patterns, url
     322        from django.conf.urls import patterns, url
    323323
    324324        def wrap(view):
    325325            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()
     
    366366You normally won't have to bother with writing 404 views. By default, URLconfs
    367367have the following line up top::
    368368
    369     from django.conf.urls.defaults import patterns, include, url
     369    from django.conf.urls import patterns, include, url
    370370
    371371That takes care of setting ``handler404`` in the current module. As you can see
    372372in ``django/conf/urls/defaults.py``, ``handler404`` is set to
     
    442442
    443443Because this is a common case, the URLconf framework provides a shortcut for
    444444common prefixes. You can factor out the common prefixes and add them as the
    445 first argument to :func:`~django.conf.urls.defaults.patterns`, like so::
     445first argument to :func:`~django.conf.urls.patterns`, like so::
    446446
    447447    urlpatterns = patterns('polls.views',
    448448        (r'^polls/$', 'index'),
     
    456456
    457457Since you generally don't want the prefix for one app to be applied to every
    458458callback in your URLconf, you can concatenate multiple
    459 :func:`~django.conf.urls.defaults.patterns`. Your full ``mysite/urls.py`` might
     459:func:`~django.conf.urls.patterns`. Your full ``mysite/urls.py`` might
    460460now look like this::
    461461
    462     from django.conf.urls.defaults import patterns, include, url
     462    from django.conf.urls import patterns, include, url
    463463
    464464    from django.contrib import admin
    465465    admin.autodiscover()
    466    
     466
    467467    urlpatterns = patterns('polls.views',
    468468        (r'^polls/$', 'index'),
    469469        (r'^polls/(?P<poll_id>\d+)/$', 'detail'),
    470470        (r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
    471471        (r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
    472472    )
    473    
     473
    474474    urlpatterns += patterns('',
    475475        url(r'^admin/', include(admin.site.urls)),
    476476    )
     
    493493
    494494Copy the file ``mysite/urls.py`` to ``polls/urls.py``. Then, change
    495495``mysite/urls.py`` to remove the poll-specific URLs and insert an
    496 :func:`~django.conf.urls.defaults.include`, leaving you with::
     496:func:`~django.conf.urls.include`, leaving you with::
    497497
    498498    # This also imports the include function
    499     from django.conf.urls.defaults import patterns, include, url
    500    
     499    from django.conf.urls import patterns, include, url
     500
    501501    from django.contrib import admin
    502502    admin.autodiscover()
    503    
     503
    504504    urlpatterns = patterns('',
    505505        (r'^polls/', include('polls.urls')),
    506506        url(r'^admin/', include(admin.site.urls)),
    507507    )
    508508
    509 :func:`~django.conf.urls.defaults.include` simply references another URLconf.
     509:func:`~django.conf.urls.include` simply references another URLconf.
    510510Note that the regular expression doesn't have a ``$`` (end-of-string match
    511511character) but has the trailing slash. Whenever Django encounters
    512 :func:`~django.conf.urls.defaults.include`, it chops off whatever part of the
     512:func:`~django.conf.urls.include`, it chops off whatever part of the
    513513URL matched up to that point and sends the remaining string to the included
    514514URLconf for further processing.
    515515
     
    526526lines registering the admin site. Your ``polls/urls.py`` file should now look like
    527527this::
    528528
    529     from django.conf.urls.defaults import patterns, include, url
     529    from django.conf.urls import patterns, include, url
    530530
    531531    urlpatterns = patterns('polls.views',
    532532        (r'^$', 'index'),
     
    535535        (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
    536536    )
    537537
    538 The idea behind :func:`~django.conf.urls.defaults.include` and URLconf
     538The idea behind :func:`~django.conf.urls.include` and URLconf
    539539decoupling is to make it easy to plug-and-play URLs. Now that polls are in their
    540540own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or
    541541under "/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  
    18211821``django.contrib.admin.site`` at the URL ``/admin/`` ::
    18221822
    18231823    # urls.py
    1824     from django.conf.urls.defaults import *
     1824    from django.conf.urls import patterns, url, include
    18251825    from django.contrib import admin
    18261826
    18271827    admin.autodiscover()
     
    18371837``myproject.admin.admin_site`` at the URL ``/myadmin/`` ::
    18381838
    18391839    # urls.py
    1840     from django.conf.urls.defaults import *
     1840    from django.conf.urls import patterns, url, include
    18411841    from myproject.admin import admin_site
    18421842
    18431843    urlpatterns = patterns('',
     
    18611861respectively::
    18621862
    18631863    # urls.py
    1864     from django.conf.urls.defaults import *
     1864    from django.conf.urls import patterns, url, include
    18651865    from myproject.admin import basic_site, advanced_site
    18661866
    18671867    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  
    701701Next, edit your ``urls.py`` in the ``geodjango`` project folder to look
    702702as follows::
    703703
    704     from django.conf.urls.defaults import *
     704    from django.conf.urls import patterns, url, include
    705705    from django.contrib.gis import admin
    706706
    707707    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  
    526526rather than the view function. A named URL pattern is defined by replacing the
    527527pattern tuple by a call to the ``url`` function)::
    528528
    529     from django.conf.urls.defaults import *
     529    from django.conf.urls import patterns, url, include
    530530
    531531    url(r'^people/(\d+)/$', 'blog_views.generic_detail', name='people_view'),
    532532
  • docs/releases/1.4.txt

    diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt
    a b  
    279279  MySQL with the InnoDB database engine.
    280280
    281281* A new 403 response handler has been added as
    282   ``'django.views.defaults.permission_denied'``. See the documentation
    283   about :ref:`the 403 (HTTP Forbidden) view<http_forbidden_view>` for more
    284   information.
     282  ``'django.views.defaults.permission_denied'``. You can set your own handler by
     283  setting the value of :data:`django.conf.urls.handler403`. See the
     284  documentation about :ref:`the 403 (HTTP Forbidden) view<http_forbidden_view>`
     285  for more information.
    285286
    286287* The :ttag:`trans` template tag now takes an optional ``as`` argument to
    287288  be able to retrieve a translation string without displaying it but setting
     
    571572
    572573The existence of any ``'filters'`` key under the ``'mail_admins'`` handler will
    573574disable this backward-compatibility shim and deprecation warning.
     575
     576``django.conf.urls.defaults``
     577~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     578
     579Until Django 1.3 the functions :func:`~django.conf.urls.include`,
     580:func:`~django.conf.urls.patterns` and :func:`~django.conf.urls.url` plus
     581:data:`~django.conf.urls.handler404`, :data:`~django.conf.urls.handler500`
     582were located in a ``django.conf.urls.defaults`` module.
     583
     584Starting 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.
     
    6565
    6666Here's a sample URLconf::
    6767
    68     from django.conf.urls.defaults import *
     68    from django.conf.urls import patterns, url, include
    6969
    7070    urlpatterns = patterns('',
    7171        (r'^articles/2003/$', 'news.views.special_case_2003'),
     
    7676
    7777Notes:
    7878
    79     * ``from django.conf.urls.defaults import *`` makes the ``patterns()``
    80       function available.
    81 
    8279    * To capture a value from the URL, just put parenthesis around it.
    8380
    8481    * There's no need to add a leading slash, because every URL has that. For
     
    180177==================================
    181178
    182179``urlpatterns`` should be a Python list, in the format returned by the function
    183 :func:`django.conf.urls.defaults.patterns`. Always use ``patterns()`` to create
     180:func:`django.conf.urls.patterns`. Always use ``patterns()`` to create
    184181the ``urlpatterns`` variable.
    185182
    186 Convention is to use ``from django.conf.urls.defaults import *`` at the top of
    187 your URLconf. This gives your module access to these objects:
     183``django.conf.urls`` also defines some other functions you'll want to use:
    188184
    189 .. module:: django.conf.urls.defaults
     185.. module:: django.conf.urls
     186
     187.. versionchanged:: 1.4
     188    Starting with Django 1.4 `functions `patterns``, ``url``, ``include`` plus
     189    the ``handler*`` symbols described below are now available in the
     190    ``django.conf.urls`` module.
     191
     192    Until Django 1.3 they were located in ``django.conf.urls.defaults``. For
     193    the time being you still can import them from there.
    190194
    191195patterns
    192196--------
     
    252256``patterns()`` and is only relevant when you're passing a string as the
    253257``view`` parameter.
    254258
     259handler403
     260----------
     261
     262.. data:: handler403
     263
     264A callable, or a string representing the full Python import path to the view
     265that should be called if the user has no the permissions required to access
     266a resource.
     267
     268By default, this is ``'django.views.defaults.permission_denied'``. That default
     269value should suffice.
     270
     271See the documentation about :ref:`the 403 (HTTP Forbidden) view
     272<http_forbidden_view>` for more information.
     273
     274.. versionadded:: 1.4
     275    ``handler403`` is new in Django 1.4.
     276
    255277handler404
    256278----------
    257279
     
    339361
    340362Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
    341363
    342     from django.conf.urls.defaults import *
     364    from django.conf.urls import patterns, url, include
    343365
    344366    urlpatterns = patterns('',
    345367        (r'^articles/(\d{4})/$', 'news.views.year_archive'),
     
    354376
    355377With this in mind, the above example can be written more concisely as::
    356378
    357     from django.conf.urls.defaults import *
     379    from django.conf.urls import patterns, url, include
    358380
    359381    urlpatterns = patterns('news.views',
    360382        (r'^articles/(\d{4})/$', 'year_archive'),
     
    375397
    376398Old::
    377399
    378     from django.conf.urls.defaults import *
     400    from django.conf.urls import patterns, url, include
    379401
    380402    urlpatterns = patterns('',
    381403        (r'^$', 'django.views.generic.date_based.archive_index'),
     
    385407
    386408New::
    387409
    388     from django.conf.urls.defaults import *
     410    from django.conf.urls import patterns, url, include
    389411
    390412    urlpatterns = patterns('django.views.generic.date_based',
    391413        (r'^$', 'archive_index'),
     
    405427For example, here's the URLconf for the `Django Web site`_ itself. It includes a
    406428number of other URLconfs::
    407429
    408     from django.conf.urls.defaults import *
     430    from django.conf.urls import patterns, url, include
    409431
    410432    urlpatterns = patterns('',
    411433        (r'^weblog/',        include('django_website.apps.blog.urls.blog')),
     
    423445URLconf Python module defining them as the `include`_ argument but by using
    424446directly the pattern list as returned by `patterns`_ instead. For example::
    425447
    426     from django.conf.urls.defaults import *
     448    from django.conf.urls import patterns, url, include
    427449
    428450    extra_patterns = patterns('',
    429451        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  
    812812.. function:: i18n_patterns(prefix, pattern_description, ...)
    813813
    814814This function can be used in your root URLconf as a replacement for the normal
    815 :func:`django.conf.urls.defaults.patterns` function. Django will automatically
     815:func:`django.conf.urls.patterns` function. Django will automatically
    816816prepend the current active language code to all url patterns defined within
    817817:func:`~django.conf.urls.i18n.i18n_patterns`. Example URL patterns::
    818818
    819     from django.conf.urls.defaults import patterns, include, url
     819    from django.conf.urls import patterns, include, url
    820820    from django.conf.urls.i18n import i18n_patterns
    821821
    822822    urlpatterns = patterns(''
     
    870870URL patterns can also be marked translatable using the
    871871:func:`~django.utils.translation.ugettext_lazy` function. Example::
    872872
    873     from django.conf.urls.defaults import patterns, include, url
     873    from django.conf.urls import patterns, include, url
    874874    from django.conf.urls.i18n import i18n_patterns
    875875    from django.utils.translation import ugettext_lazy as _
    876876
  • 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