We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Bulk attendee upload is broken
I am gettting an error uploading attendees using a CSV. I have done it successfully in the past using the same format CSV. For now, I have attended the participants manually.

Attached is my upload csv with the emails replaced with test@test.com to preserve privacy.

[attendees.txt](https://github.com/kartoza/prj.app/files/4202985/attendees.txt)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `django_project/certification/views/attendee.py`
Content:
```
1 # coding=utf-8
2 import csv
3 from django.db import transaction
4 from django.urls import reverse
5 from django.views.generic import (
6     CreateView, FormView)
7 from braces.views import LoginRequiredMixin, FormMessagesMixin
8 from certification.models import (
9     Attendee, CertifyingOrganisation, CourseAttendee, Course
10 )
11 from certification.forms import AttendeeForm, CsvAttendeeForm
12 
13 
14 class AttendeeMixin(object):
15     """Mixin class to provide standard settings for Attendee."""
16 
17     model = Attendee
18     form_class = AttendeeForm
19 
20 
21 class AttendeeCreateView(LoginRequiredMixin, AttendeeMixin, CreateView):
22     """Create view for Attendee."""
23 
24     context_object_name = 'attendee'
25     template_name = 'attendee/create.html'
26 
27     def get_success_url(self):
28         """Define the redirect URL.
29 
30         After successful creation of the object, the User will be redirected
31         to the create course attendee page.
32 
33        :returns: URL
34        :rtype: HttpResponse
35        """
36         add_to_course = self.request.POST.get('add_to_course')
37         if add_to_course is None:
38             success_url = reverse('courseattendee-create', kwargs={
39                 'project_slug': self.project_slug,
40                 'organisation_slug': self.organisation_slug,
41                 'slug': self.course_slug,
42             })
43         else:
44             success_url = reverse('course-detail', kwargs={
45                 'project_slug': self.project_slug,
46                 'organisation_slug': self.organisation_slug,
47                 'slug': self.course_slug,
48             })
49         return success_url
50 
51     def get_context_data(self, **kwargs):
52         """Get the context data which is passed to a template.
53 
54         :param kwargs: Any arguments to pass to the superclass.
55         :type kwargs: dict
56 
57         :returns: Context data which will be passed to the template.
58         :rtype: dict
59         """
60 
61         context = super(
62             AttendeeCreateView, self).get_context_data(**kwargs)
63         return context
64 
65     def get_form_kwargs(self):
66         """Get keyword arguments from form.
67 
68         :returns keyword argument from the form
69         :rtype: dict
70         """
71 
72         kwargs = super(AttendeeCreateView, self).get_form_kwargs()
73         self.project_slug = self.kwargs.get('project_slug', None)
74         self.organisation_slug = self.kwargs.get('organisation_slug', None)
75         self.course_slug = self.kwargs.get('slug', None)
76         self.certifying_organisation = \
77             CertifyingOrganisation.objects.get(slug=self.organisation_slug)
78         kwargs.update({
79             'user': self.request.user,
80             'certifying_organisation': self.certifying_organisation
81         })
82         return kwargs
83 
84     def form_valid(self, form):
85         add_to_course = self.request.POST.get('add_to_course')
86         if add_to_course is None:
87             if form.is_valid():
88                 form.save()
89         else:
90             if form.is_valid():
91                 object = form.save()
92                 course_slug = self.kwargs.get('slug', None)
93                 course = Course.objects.get(slug=course_slug)
94                 course_attendee = CourseAttendee(
95                     attendee=object,
96                     course=course,
97                     author=self.request.user
98                 )
99                 course_attendee.save()
100         return super(AttendeeCreateView, self).form_valid(form)
101 
102 
103 class CsvUploadView(FormMessagesMixin, LoginRequiredMixin, FormView):
104     """
105     Allow upload of attendees through CSV file.
106     """
107 
108     context_object_name = 'csvupload'
109     form_class = CsvAttendeeForm
110     template_name = 'attendee/upload_attendee_csv.html'
111 
112     def get_success_url(self):
113         """Define the redirect URL.
114 
115         After successful creation of the object, the User will be redirected
116         to the Course detail page.
117 
118        :returns: URL
119        :rtype: HttpResponse
120        """
121 
122         return reverse('course-detail', kwargs={
123             'project_slug': self.project_slug,
124             'organisation_slug': self.organisation_slug,
125             'slug': self.slug,
126         })
127 
128     def get_context_data(self, **kwargs):
129         """Get the context data which is passed to a template.
130 
131         :param kwargs: Any arguments to pass to the superclass.
132         :type kwargs: dict
133 
134         :returns: Context data which will be passed to the template.
135         :rtype: dict
136         """
137 
138         context = super(
139             CsvUploadView, self).get_context_data(**kwargs)
140         context['certifyingorganisation'] = \
141             CertifyingOrganisation.objects.get(slug=self.organisation_slug)
142         context['course'] = Course.objects.get(slug=self.slug)
143         return context
144 
145     def get_form_kwargs(self):
146         """Get keyword arguments from form.
147 
148         :returns keyword argument from the form
149         :rtype: dict
150         """
151 
152         kwargs = super(CsvUploadView, self).get_form_kwargs()
153         self.project_slug = self.kwargs.get('project_slug', None)
154         self.organisation_slug = self.kwargs.get('organisation_slug', None)
155         self.slug = self.kwargs.get('slug', None)
156         self.course = Course.objects.get(slug=self.slug)
157         self.certifying_organisation = \
158             CertifyingOrganisation.objects.get(slug=self.organisation_slug)
159         return kwargs
160 
161     @transaction.atomic()
162     def post(self, request, *args, **kwargs):
163         """Get form instance from upload.
164 
165            After successful creation of the object,the User
166            will be redirected to the create course attendee page.
167 
168           :returns: URL
169           :rtype: HttpResponse
170         """
171         form_class = self.get_form_class()
172         form = self.get_form(form_class)
173         attendees_file = request.FILES.get('file')
174         course = Course.objects.get(slug=self.slug)
175         if form.is_valid():
176             if attendees_file:
177                 reader = csv.reader(attendees_file, delimiter=',')
178                 next(reader)
179                 attendee_count = 0
180                 course_attendee_count = 0
181                 for row in reader:
182                     # We should have logic here to first see if the attendee
183                     # already exists and if they do, just add them to the
184                     # course
185                     attendee = Attendee(
186                         firstname=row[0],
187                         surname=row[1],
188                         email=row[2],
189                         certifying_organisation=self.certifying_organisation,
190                         author=self.request.user,
191                     )
192                     try:
193                         attendee.save()
194                         attendee_count += 1
195                     except:  # noqa
196                         #  Could not save - probably they exist already
197                         attendee = None
198 
199                     if not attendee:
200                         # put more checks in case attendee
201                         # does not already exist
202                         continue
203 
204                     course_attendee = CourseAttendee(
205                         attendee=attendee,
206                         course=course,
207                         author=self.request.user,
208                     )
209                     try:
210                         course_attendee.save()
211                         course_attendee_count += 1
212                     except:  # noqa
213                         #  They are probably already associated with a course
214                         pass
215 
216                 self.form_valid_message = (
217                     '%i new attendees were created, and %i attendees were '
218                     'added to the course: % s' % (
219                         attendee_count, course_attendee_count, self.course)
220                 )
221 
222                 self.form_invalid_message = (
223                     'Something wrong happened while running the upload. '
224                     'Please contact site support to help resolving the issue.')
225             return self.form_valid(form)
226 
227         else:
228             return self.form_invalid(form)
229
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/django_project/certification/views/attendee.py b/django_project/certification/views/attendee.py
--- a/django_project/certification/views/attendee.py
+++ b/django_project/certification/views/attendee.py
@@ -1,4 +1,5 @@
 # coding=utf-8
+import io
 import csv
 from django.db import transaction
 from django.urls import reverse
@@ -171,11 +172,13 @@
         form_class = self.get_form_class()
         form = self.get_form(form_class)
         attendees_file = request.FILES.get('file')
+        attendees_file.seek(0)
         course = Course.objects.get(slug=self.slug)
         if form.is_valid():
             if attendees_file:
-                reader = csv.reader(attendees_file, delimiter=',')
-                next(reader)
+                reader = csv.DictReader(
+                    io.StringIO(attendees_file.read().decode('utf-8'))
+                )
                 attendee_count = 0
                 course_attendee_count = 0
                 for row in reader:
@@ -183,9 +186,9 @@
                     # already exists and if they do, just add them to the
                     # course
                     attendee = Attendee(
-                        firstname=row[0],
-                        surname=row[1],
-                        email=row[2],
+                        firstname=row['First Name'],
+                        surname=row['Surname'],
+                        email=row['Email'],
                         certifying_organisation=self.certifying_organisation,
                         author=self.request.user,
                     )

{"golden_diff": "diff --git a/django_project/certification/views/attendee.py b/django_project/certification/views/attendee.py\n--- a/django_project/certification/views/attendee.py\n+++ b/django_project/certification/views/attendee.py\n@@ -1,4 +1,5 @@\n # coding=utf-8\n+import io\n import csv\n from django.db import transaction\n from django.urls import reverse\n@@ -171,11 +172,13 @@\n         form_class = self.get_form_class()\n         form = self.get_form(form_class)\n         attendees_file = request.FILES.get('file')\n+        attendees_file.seek(0)\n         course = Course.objects.get(slug=self.slug)\n         if form.is_valid():\n             if attendees_file:\n-                reader = csv.reader(attendees_file, delimiter=',')\n-                next(reader)\n+                reader = csv.DictReader(\n+                    io.StringIO(attendees_file.read().decode('utf-8'))\n+                )\n                 attendee_count = 0\n                 course_attendee_count = 0\n                 for row in reader:\n@@ -183,9 +186,9 @@\n                     # already exists and if they do, just add them to the\n                     # course\n                     attendee = Attendee(\n-                        firstname=row[0],\n-                        surname=row[1],\n-                        email=row[2],\n+                        firstname=row['First Name'],\n+                        surname=row['Surname'],\n+                        email=row['Email'],\n                         certifying_organisation=self.certifying_organisation,\n                         author=self.request.user,\n                     )\n", "issue": "Bulk attendee upload is broken\nI am gettting an error uploading attendees using a CSV. I have done it successfully in the past using the same format CSV. For now, I have attended the participants manually.\r\n\r\nAttached is my upload csv with the emails replaced with test@test.com to preserve privacy.\r\n\r\n[attendees.txt](https://github.com/kartoza/prj.app/files/4202985/attendees.txt)\r\n\n", "before_files": [{"content": "# coding=utf-8\nimport csv\nfrom django.db import transaction\nfrom django.urls import reverse\nfrom django.views.generic import (\n    CreateView, FormView)\nfrom braces.views import LoginRequiredMixin, FormMessagesMixin\nfrom certification.models import (\n    Attendee, CertifyingOrganisation, CourseAttendee, Course\n)\nfrom certification.forms import AttendeeForm, CsvAttendeeForm\n\n\nclass AttendeeMixin(object):\n    \"\"\"Mixin class to provide standard settings for Attendee.\"\"\"\n\n    model = Attendee\n    form_class = AttendeeForm\n\n\nclass AttendeeCreateView(LoginRequiredMixin, AttendeeMixin, CreateView):\n    \"\"\"Create view for Attendee.\"\"\"\n\n    context_object_name = 'attendee'\n    template_name = 'attendee/create.html'\n\n    def get_success_url(self):\n        \"\"\"Define the redirect URL.\n\n        After successful creation of the object, the User will be redirected\n        to the create course attendee page.\n\n       :returns: URL\n       :rtype: HttpResponse\n       \"\"\"\n        add_to_course = self.request.POST.get('add_to_course')\n        if add_to_course is None:\n            success_url = reverse('courseattendee-create', kwargs={\n                'project_slug': self.project_slug,\n                'organisation_slug': self.organisation_slug,\n                'slug': self.course_slug,\n            })\n        else:\n            success_url = reverse('course-detail', kwargs={\n                'project_slug': self.project_slug,\n                'organisation_slug': self.organisation_slug,\n                'slug': self.course_slug,\n            })\n        return success_url\n\n    def get_context_data(self, **kwargs):\n        \"\"\"Get the context data which is passed to a template.\n\n        :param kwargs: Any arguments to pass to the superclass.\n        :type kwargs: dict\n\n        :returns: Context data which will be passed to the template.\n        :rtype: dict\n        \"\"\"\n\n        context = super(\n            AttendeeCreateView, self).get_context_data(**kwargs)\n        return context\n\n    def get_form_kwargs(self):\n        \"\"\"Get keyword arguments from form.\n\n        :returns keyword argument from the form\n        :rtype: dict\n        \"\"\"\n\n        kwargs = super(AttendeeCreateView, self).get_form_kwargs()\n        self.project_slug = self.kwargs.get('project_slug', None)\n        self.organisation_slug = self.kwargs.get('organisation_slug', None)\n        self.course_slug = self.kwargs.get('slug', None)\n        self.certifying_organisation = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        kwargs.update({\n            'user': self.request.user,\n            'certifying_organisation': self.certifying_organisation\n        })\n        return kwargs\n\n    def form_valid(self, form):\n        add_to_course = self.request.POST.get('add_to_course')\n        if add_to_course is None:\n            if form.is_valid():\n                form.save()\n        else:\n            if form.is_valid():\n                object = form.save()\n                course_slug = self.kwargs.get('slug', None)\n                course = Course.objects.get(slug=course_slug)\n                course_attendee = CourseAttendee(\n                    attendee=object,\n                    course=course,\n                    author=self.request.user\n                )\n                course_attendee.save()\n        return super(AttendeeCreateView, self).form_valid(form)\n\n\nclass CsvUploadView(FormMessagesMixin, LoginRequiredMixin, FormView):\n    \"\"\"\n    Allow upload of attendees through CSV file.\n    \"\"\"\n\n    context_object_name = 'csvupload'\n    form_class = CsvAttendeeForm\n    template_name = 'attendee/upload_attendee_csv.html'\n\n    def get_success_url(self):\n        \"\"\"Define the redirect URL.\n\n        After successful creation of the object, the User will be redirected\n        to the Course detail page.\n\n       :returns: URL\n       :rtype: HttpResponse\n       \"\"\"\n\n        return reverse('course-detail', kwargs={\n            'project_slug': self.project_slug,\n            'organisation_slug': self.organisation_slug,\n            'slug': self.slug,\n        })\n\n    def get_context_data(self, **kwargs):\n        \"\"\"Get the context data which is passed to a template.\n\n        :param kwargs: Any arguments to pass to the superclass.\n        :type kwargs: dict\n\n        :returns: Context data which will be passed to the template.\n        :rtype: dict\n        \"\"\"\n\n        context = super(\n            CsvUploadView, self).get_context_data(**kwargs)\n        context['certifyingorganisation'] = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        context['course'] = Course.objects.get(slug=self.slug)\n        return context\n\n    def get_form_kwargs(self):\n        \"\"\"Get keyword arguments from form.\n\n        :returns keyword argument from the form\n        :rtype: dict\n        \"\"\"\n\n        kwargs = super(CsvUploadView, self).get_form_kwargs()\n        self.project_slug = self.kwargs.get('project_slug', None)\n        self.organisation_slug = self.kwargs.get('organisation_slug', None)\n        self.slug = self.kwargs.get('slug', None)\n        self.course = Course.objects.get(slug=self.slug)\n        self.certifying_organisation = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        return kwargs\n\n    @transaction.atomic()\n    def post(self, request, *args, **kwargs):\n        \"\"\"Get form instance from upload.\n\n           After successful creation of the object,the User\n           will be redirected to the create course attendee page.\n\n          :returns: URL\n          :rtype: HttpResponse\n        \"\"\"\n        form_class = self.get_form_class()\n        form = self.get_form(form_class)\n        attendees_file = request.FILES.get('file')\n        course = Course.objects.get(slug=self.slug)\n        if form.is_valid():\n            if attendees_file:\n                reader = csv.reader(attendees_file, delimiter=',')\n                next(reader)\n                attendee_count = 0\n                course_attendee_count = 0\n                for row in reader:\n                    # We should have logic here to first see if the attendee\n                    # already exists and if they do, just add them to the\n                    # course\n                    attendee = Attendee(\n                        firstname=row[0],\n                        surname=row[1],\n                        email=row[2],\n                        certifying_organisation=self.certifying_organisation,\n                        author=self.request.user,\n                    )\n                    try:\n                        attendee.save()\n                        attendee_count += 1\n                    except:  # noqa\n                        #  Could not save - probably they exist already\n                        attendee = None\n\n                    if not attendee:\n                        # put more checks in case attendee\n                        # does not already exist\n                        continue\n\n                    course_attendee = CourseAttendee(\n                        attendee=attendee,\n                        course=course,\n                        author=self.request.user,\n                    )\n                    try:\n                        course_attendee.save()\n                        course_attendee_count += 1\n                    except:  # noqa\n                        #  They are probably already associated with a course\n                        pass\n\n                self.form_valid_message = (\n                    '%i new attendees were created, and %i attendees were '\n                    'added to the course: % s' % (\n                        attendee_count, course_attendee_count, self.course)\n                )\n\n                self.form_invalid_message = (\n                    'Something wrong happened while running the upload. '\n                    'Please contact site support to help resolving the issue.')\n            return self.form_valid(form)\n\n        else:\n            return self.form_invalid(form)\n", "path": "django_project/certification/views/attendee.py"}], "after_files": [{"content": "# coding=utf-8\nimport io\nimport csv\nfrom django.db import transaction\nfrom django.urls import reverse\nfrom django.views.generic import (\n    CreateView, FormView)\nfrom braces.views import LoginRequiredMixin, FormMessagesMixin\nfrom certification.models import (\n    Attendee, CertifyingOrganisation, CourseAttendee, Course\n)\nfrom certification.forms import AttendeeForm, CsvAttendeeForm\n\n\nclass AttendeeMixin(object):\n    \"\"\"Mixin class to provide standard settings for Attendee.\"\"\"\n\n    model = Attendee\n    form_class = AttendeeForm\n\n\nclass AttendeeCreateView(LoginRequiredMixin, AttendeeMixin, CreateView):\n    \"\"\"Create view for Attendee.\"\"\"\n\n    context_object_name = 'attendee'\n    template_name = 'attendee/create.html'\n\n    def get_success_url(self):\n        \"\"\"Define the redirect URL.\n\n        After successful creation of the object, the User will be redirected\n        to the create course attendee page.\n\n       :returns: URL\n       :rtype: HttpResponse\n       \"\"\"\n        add_to_course = self.request.POST.get('add_to_course')\n        if add_to_course is None:\n            success_url = reverse('courseattendee-create', kwargs={\n                'project_slug': self.project_slug,\n                'organisation_slug': self.organisation_slug,\n                'slug': self.course_slug,\n            })\n        else:\n            success_url = reverse('course-detail', kwargs={\n                'project_slug': self.project_slug,\n                'organisation_slug': self.organisation_slug,\n                'slug': self.course_slug,\n            })\n        return success_url\n\n    def get_context_data(self, **kwargs):\n        \"\"\"Get the context data which is passed to a template.\n\n        :param kwargs: Any arguments to pass to the superclass.\n        :type kwargs: dict\n\n        :returns: Context data which will be passed to the template.\n        :rtype: dict\n        \"\"\"\n\n        context = super(\n            AttendeeCreateView, self).get_context_data(**kwargs)\n        return context\n\n    def get_form_kwargs(self):\n        \"\"\"Get keyword arguments from form.\n\n        :returns keyword argument from the form\n        :rtype: dict\n        \"\"\"\n\n        kwargs = super(AttendeeCreateView, self).get_form_kwargs()\n        self.project_slug = self.kwargs.get('project_slug', None)\n        self.organisation_slug = self.kwargs.get('organisation_slug', None)\n        self.course_slug = self.kwargs.get('slug', None)\n        self.certifying_organisation = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        kwargs.update({\n            'user': self.request.user,\n            'certifying_organisation': self.certifying_organisation\n        })\n        return kwargs\n\n    def form_valid(self, form):\n        add_to_course = self.request.POST.get('add_to_course')\n        if add_to_course is None:\n            if form.is_valid():\n                form.save()\n        else:\n            if form.is_valid():\n                object = form.save()\n                course_slug = self.kwargs.get('slug', None)\n                course = Course.objects.get(slug=course_slug)\n                course_attendee = CourseAttendee(\n                    attendee=object,\n                    course=course,\n                    author=self.request.user\n                )\n                course_attendee.save()\n        return super(AttendeeCreateView, self).form_valid(form)\n\n\nclass CsvUploadView(FormMessagesMixin, LoginRequiredMixin, FormView):\n    \"\"\"\n    Allow upload of attendees through CSV file.\n    \"\"\"\n\n    context_object_name = 'csvupload'\n    form_class = CsvAttendeeForm\n    template_name = 'attendee/upload_attendee_csv.html'\n\n    def get_success_url(self):\n        \"\"\"Define the redirect URL.\n\n        After successful creation of the object, the User will be redirected\n        to the Course detail page.\n\n       :returns: URL\n       :rtype: HttpResponse\n       \"\"\"\n\n        return reverse('course-detail', kwargs={\n            'project_slug': self.project_slug,\n            'organisation_slug': self.organisation_slug,\n            'slug': self.slug,\n        })\n\n    def get_context_data(self, **kwargs):\n        \"\"\"Get the context data which is passed to a template.\n\n        :param kwargs: Any arguments to pass to the superclass.\n        :type kwargs: dict\n\n        :returns: Context data which will be passed to the template.\n        :rtype: dict\n        \"\"\"\n\n        context = super(\n            CsvUploadView, self).get_context_data(**kwargs)\n        context['certifyingorganisation'] = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        context['course'] = Course.objects.get(slug=self.slug)\n        return context\n\n    def get_form_kwargs(self):\n        \"\"\"Get keyword arguments from form.\n\n        :returns keyword argument from the form\n        :rtype: dict\n        \"\"\"\n\n        kwargs = super(CsvUploadView, self).get_form_kwargs()\n        self.project_slug = self.kwargs.get('project_slug', None)\n        self.organisation_slug = self.kwargs.get('organisation_slug', None)\n        self.slug = self.kwargs.get('slug', None)\n        self.course = Course.objects.get(slug=self.slug)\n        self.certifying_organisation = \\\n            CertifyingOrganisation.objects.get(slug=self.organisation_slug)\n        return kwargs\n\n    @transaction.atomic()\n    def post(self, request, *args, **kwargs):\n        \"\"\"Get form instance from upload.\n\n           After successful creation of the object,the User\n           will be redirected to the create course attendee page.\n\n          :returns: URL\n          :rtype: HttpResponse\n        \"\"\"\n        form_class = self.get_form_class()\n        form = self.get_form(form_class)\n        attendees_file = request.FILES.get('file')\n        attendees_file.seek(0)\n        course = Course.objects.get(slug=self.slug)\n        if form.is_valid():\n            if attendees_file:\n                reader = csv.DictReader(\n                    io.StringIO(attendees_file.read().decode('utf-8'))\n                )\n                attendee_count = 0\n                course_attendee_count = 0\n                for row in reader:\n                    # We should have logic here to first see if the attendee\n                    # already exists and if they do, just add them to the\n                    # course\n                    attendee = Attendee(\n                        firstname=row['First Name'],\n                        surname=row['Surname'],\n                        email=row['Email'],\n                        certifying_organisation=self.certifying_organisation,\n                        author=self.request.user,\n                    )\n                    try:\n                        attendee.save()\n                        attendee_count += 1\n                    except:  # noqa\n                        #  Could not save - probably they exist already\n                        attendee = None\n\n                    if not attendee:\n                        # put more checks in case attendee\n                        # does not already exist\n                        continue\n\n                    course_attendee = CourseAttendee(\n                        attendee=attendee,\n                        course=course,\n                        author=self.request.user,\n                    )\n                    try:\n                        course_attendee.save()\n                        course_attendee_count += 1\n                    except:  # noqa\n                        #  They are probably already associated with a course\n                        pass\n\n                self.form_valid_message = (\n                    '%i new attendees were created, and %i attendees were '\n                    'added to the course: % s' % (\n                        attendee_count, course_attendee_count, self.course)\n                )\n\n                self.form_invalid_message = (\n                    'Something wrong happened while running the upload. '\n                    'Please contact site support to help resolving the issue.')\n            return self.form_valid(form)\n\n        else:\n            return self.form_invalid(form)\n", "path": "django_project/certification/views/attendee.py"}]}