Form.html в Django CreateView

Ниже приведен мой код.

class ArticleCreateView(OwnerCreateView):
    model = Article
    fields = ['title', 'text']
class OwnerCreateView(LoginRequiredMixin, CreateView):
    """
    Sub-class of the CreateView to automatically pass the Request to the Form
    and add the owner to the saved object.
    """

    # Saves the form instance, sets the current object for the view, and redirects to get_success_url().
    def form_valid(self, form):
        print('form_valid called')
        object = form.save(commit=False)
        object.owner = self.request.user
        object.save()
        return super(OwnerCreateView, self).form_valid(form)

У меня /home/JongRok/dj4e-samples/myarts/templates/myarts есть acticle_form.html

{% extends "base_bootstrap.html" %}
{% load crispy_forms_tags %}
{% block content %}
<p>
  <form action="" method="post">
    {% csrf_token %}
    {{ form|crispy }}
    <input type="submit" value="Submit">
    <input type="submit" value="Cancel" onclick="window.location.href='{% url 'myarts:all' %}';return false;">
  </form>
</p>
{% endblock %}

Я не понимаю, как Django CreateView находит форму. Я не помещаю форму в ArticleCreateView и у меня нет form.py.

Как Django CreateView находит себя в форме модели???

Вернуться на верх