Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #19283 -- Fixed typo in imports in CBV docs.

  • Loading branch information...
commit 00ff69a827b38054afe557fc7d0a589b270ed871 1 parent e27a43c
@aaugustin aaugustin authored
View
2  docs/ref/class-based-views/generic-editing.txt
@@ -16,8 +16,8 @@ editing content:
has been defined. For these cases we assume the following has been defined
in `myapp/models.py`::
- from django import models
from django.core.urlresolvers import reverse
+ from django.db import models
class Author(models.Model):
name = models.CharField(max_length=200)
View
12 docs/topics/class-based-views/generic-editing.txt
@@ -90,8 +90,8 @@ class:
.. code-block:: python
# models.py
- from django import models
from django.core.urlresolvers import reverse
+ from django.db import models
class Author(models.Model):
name = models.CharField(max_length=200)
@@ -102,7 +102,7 @@ class:
Then we can use :class:`CreateView` and friends to do the actual
work. Notice how we're just configuring the generic class-based views
here; we don't have to write any logic ourselves::
-
+
# views.py
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
@@ -134,7 +134,7 @@ Finally, we hook these new views into the URLconf::
url(r'author/(?P<pk>\d+)/$', AuthorUpdate.as_view(), name='author_update'),
url(r'author/(?P<pk>\d+)/delete/$', AuthorDelete.as_view(), name='author_delete'),
)
-
+
.. note::
These views inherit :class:`~django.views.generic.detail.SingleObjectTemplateResponseMixin`
@@ -160,8 +160,8 @@ you can use a custom :class:`ModelForm` to do this. First, add the
foreign key relation to the model::
# models.py
- from django import models
from django.contrib.auth import User
+ from django.db import models
class Author(models.Model):
name = models.CharField(max_length=200)
@@ -177,7 +177,7 @@ Create a custom :class:`ModelForm` in order to exclude the
# forms.py
from django import forms
from myapp.models import Author
-
+
class AuthorForm(forms.ModelForm):
class Meta:
model = Author
@@ -190,7 +190,7 @@ In the view, use the custom :attr:`form_class` and override
from django.views.generic.edit import CreateView
from myapp.models import Author
from myapp.forms import AuthorForm
-
+
class AuthorCreate(CreateView):
form_class = AuthorForm
model = Author
Please sign in to comment.
Something went wrong with that request. Please try again.