resource. The main assumption is that higher levels of the path contains a slug
or pk that points to the related model's object.
+The key difference between normal CreateView, which can be persuaded to give
+you the related object using the ``queryset`` attribute and ``get_object``
+method, and this mixin, lies in the form processing. This mixin does two things
+1. It ensures that the related object exists (behavior similar to
+ ``get_object`` is forced)
+2. It attaches the related object to the appropriate field in the submitted
from related import CreateWithRelatedMixin
form_class = CustomAttachmentModelForm
-With the above setup, the ``django.http.Http404`` is raised if post with the
-slug as in the URL does not exist. Otherwise, the ``CustomAttachmentModelForm``
+With the above setup, the ``django.http.Http404`` is raised if GET request is
+made to this view with the slug in the URL that points to a non-existent post.
+If POST request is made to the same URL, ``django.http.HttpResponseGone`` (410)
+is returned if post does not exist. Otherwise, the ``CustomAttachmentModelForm``
is processed, and the ``Post`` object that was found based on the slug will be
added to ``post`` field of the object resulting from the form processing.
If specified, the view will redirect instead of raising
- ``django.http.Http404``. Default is ``None``.
+ ``django.http.Http404`` or returning ``django.http.HttpResponseGone``.
If ``related_404_redirect_url`` is used, the ``django.contrib.messages`` is