mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Updated tutorial to use explicit relative imports.
This commit is contained in:
parent
ff5e47e7a4
commit
b2f331dc68
4 changed files with 24 additions and 17 deletions
|
@ -73,7 +73,7 @@ create a real version. Add the following to ``polls/views.py``:
|
|||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from polls.models import Choice, Question
|
||||
from .models import Choice, Question
|
||||
# ...
|
||||
def vote(request, question_id):
|
||||
p = get_object_or_404(Question, pk=question_id)
|
||||
|
@ -225,7 +225,7 @@ First, open the ``polls/urls.py`` URLconf and change it like so:
|
|||
|
||||
from django.conf.urls import url
|
||||
|
||||
from polls import views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
|
@ -254,7 +254,7 @@ views and use Django's generic views instead. To do so, open the
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.views import generic
|
||||
|
||||
from polls.models import Choice, Question
|
||||
from .models import Choice, Question
|
||||
|
||||
|
||||
class IndexView(generic.ListView):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue