from django.views.generic.edit import CreateView

from templated_email.generic_views import TemplatedEmailFormViewMixin
from tests.generic_views.models import Author


# This view send a welcome email to the author
class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView):
    model = Author
    fields = ['name', 'email']
    templated_email_template_name = 'welcome'
    templated_email_recipient_form_field = 'email'
    template_name = 'authors/create_author.html'
    success_url = '/create_author/'

    def templated_email_get_recipients(self, form):
        return [form.data['email']]

from django.views.generic.edit import CreateView

from templated_email.generic_views import TemplatedEmailFormViewMixin
from tests.generic_views.models import Author


# This view send a welcome email to the author
class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView):
    model = Author
    fields = ['name', 'email']
    templated_email_template_name = 'welcome'
    template_name = 'authors/create_author.html'
    success_url = '/create_author/'

    def templated_email_get_recipients(self, form):
        return [form.data['email']]

Remove unecessary attribute from test
Remove unecessary attribute from test
  from django.views.generic.edit import CreateView
  
  from templated_email.generic_views import TemplatedEmailFormViewMixin
  from tests.generic_views.models import Author
  
  
  # This view send a welcome email to the author
  class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView):
      model = Author
      fields = ['name', 'email']
      templated_email_template_name = 'welcome'
-     templated_email_recipient_form_field = 'email'
      template_name = 'authors/create_author.html'
      success_url = '/create_author/'
  
      def templated_email_get_recipients(self, form):
          return [form.data['email']]
  
Remove unecessary attribute from test
## Code Before:
from django.views.generic.edit import CreateView

from templated_email.generic_views import TemplatedEmailFormViewMixin
from tests.generic_views.models import Author


# This view send a welcome email to the author
class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView):
    model = Author
    fields = ['name', 'email']
    templated_email_template_name = 'welcome'
    templated_email_recipient_form_field = 'email'
    template_name = 'authors/create_author.html'
    success_url = '/create_author/'

    def templated_email_get_recipients(self, form):
        return [form.data['email']]

## Instruction:
Remove unecessary attribute from test
## Code After:
from django.views.generic.edit import CreateView

from templated_email.generic_views import TemplatedEmailFormViewMixin
from tests.generic_views.models import Author


# This view send a welcome email to the author
class AuthorCreateView(TemplatedEmailFormViewMixin, CreateView):
    model = Author
    fields = ['name', 'email']
    templated_email_template_name = 'welcome'
    template_name = 'authors/create_author.html'
    success_url = '/create_author/'

    def templated_email_get_recipients(self, form):
        return [form.data['email']]
