internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: kartoza/prj.app

Issue:
Remove automated email for participants



Discussion:

Resolving patch:
diff --git a/django_project/certification/views/certificate.py b/django_project/certification/views/certificate.py
--- a/django_project/certification/views/certificate.py
+++ b/django_project/certification/views/certificate.py
@@ -4,7 +4,6 @@
 import zipfile
 from django.http import Http404, HttpResponse, HttpResponseRedirect
 from django.views.generic import CreateView, DetailView
-from django.core.mail import send_mail
 from django.core.urlresolvers import reverse
 from django.db import IntegrityError
 from django.core.exceptions import ValidationError
@@ -109,43 +108,6 @@ def form_valid(self, form):
             organisation.organisation_credits = remaining_credits
             organisation.save()
 
-            pk = self.attendee.pk
-            site = self.request.get_host()
-
-            # Send email to the attendee when the certificate is issued.
-            send_mail(
-                'Certificate from %s Course' % self.course.course_type,
-                'Dear %s %s,\n\n' % (
-                    self.attendee.firstname, self.attendee.surname) +
-                'Congratulations!\n'
-                'Your certificate from the following course '
-                'has been issued.\n\n' +
-                'Course type: %s\n' % self.course.course_type +
-                'Course date: %s to %s\n' % (
-                    self.course.start_date.strftime('%d %B %Y'),
-                    self.course.end_date.strftime('%d %B %Y')) +
-                'Training center: %s\n' % self.course.training_center +
-                'Certifying organisation: %s\n\n'
-                % self.course.certifying_organisation.name +
-                'You may print the certificate '
-                'by visiting:\n'
-                'http://%s/en/%s/certifyingorganisation/%s/course/'
-                '%s/print/%s/\n\n' % (
-                    site,
-                    self.course.certifying_organisation.project.slug,
-                    self.course.certifying_organisation.slug,
-                    self.course.slug,
-                    pk
-                ) +
-                'Sincerely,\n%s %s' % (
-                    self.course.course_convener.user.first_name,
-                    self.course.course_convener.user.last_name
-                ),
-                self.course.course_convener.user.email,
-                [self.attendee.email],
-                fail_silently=False,
-            )
-
             return HttpResponseRedirect(self.get_success_url())
         except IntegrityError:
             return ValidationError(


Test patch:
Repository: kartoza/prj.app

Issue:
certificate cannot be viewed using chrome



Discussion:

Resolving patch:
diff --git a/django_project/certification/views/certificate.py b/django_project/certification/views/certificate.py
--- a/django_project/certification/views/certificate.py
+++ b/django_project/certification/views/certificate.py
@@ -229,9 +229,6 @@ def certificate_pdf_view(request, **kwargs):
     current_site = request.META['HTTP_HOST']
 
     # Create the HttpResponse object with the appropriate PDF headers.
-    response = HttpResponse(content_type='application/pdf')
-    response['Content-Disposition'] = \
-        'filename=%s.pdf' % certificate.certificateID
     filename = "{}.{}".format(certificate.certificateID, "pdf")
     project_folder = (project.name.lower()).replace(' ', '_')
     pathname = \
@@ -242,7 +239,7 @@ def certificate_pdf_view(request, **kwargs):
         with open(pathname, 'r') as pdf:
             response = HttpResponse(pdf.read(), content_type='application/pdf')
             response['Content-Disposition'] = \
-                'filename=%s' % pdf
+                'filename=%s' % certificate.certificateID
             return response
     else:
         makepath = '/home/web/media/pdf/%s/' % project_folder
@@ -391,7 +388,7 @@ def certificate_pdf_view(request, **kwargs):
         with open(pathname, 'r') as pdf:
             response = HttpResponse(pdf.read(), content_type='application/pdf')
             response['Content-Disposition'] = \
-                'filename=%s' % pdf
+                'filename=%s' % certificate.certificateID
             return response
 
 


Test patch:
Repository: kartoza/prj.app

Issue:
Project home page tweaks
Thanks @ann26 I have tested your stuff on staging (for #528) - its looking really nice. Some more requests:

* can you include markdown support for precis
* the content blocks for teams certification and releases dont contain anything yet I would expect them to contain a list of latest releases, teams etc
* for the project page, if you are a loged in user can you put a link to edit the project (like we have on the other project pages)
* the project logo should go above the project title
and the project description (one liner) should go below the project title centered and in italics


Discussion:

Resolving patch:
diff --git a/django_project/base/migrations/0006_auto_20170919_1202.py b/django_project/base/migrations/0006_auto_20170919_1202.py
--- a/django_project/base/migrations/0006_auto_20170919_1202.py
+++ b/django_project/base/migrations/0006_auto_20170919_1202.py
@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
         migrations.AddField(
             model_name='project',
             name='precis',
-            field=models.TextField(help_text='A detailed summary of the project.', max_length=2000, null=True, blank=True),
+            field=models.TextField(help_text='A detailed summary of the project. Markdown is supported.', max_length=2000, null=True, blank=True),
         ),
         migrations.AlterField(
             model_name='project',
diff --git a/django_project/base/models/project.py b/django_project/base/models/project.py
--- a/django_project/base/models/project.py
+++ b/django_project/base/models/project.py
@@ -83,7 +83,8 @@ class Project(models.Model):
     )
 
     precis = models.TextField(
-        help_text=_('A detailed summary of the project.'),
+        help_text=_(
+            'A detailed summary of the project. Markdown is supported.'),
         max_length=2000,
         blank=True,
         null=True
diff --git a/django_project/base/views/project.py b/django_project/base/views/project.py
--- a/django_project/base/views/project.py
+++ b/django_project/base/views/project.py
@@ -128,9 +128,8 @@ def get_context_data(self, **kwargs):
         context = super(ProjectDetailView, self).get_context_data(**kwargs)
         context['projects'] = self.get_queryset()
         context['committees'] = Committee.objects.filter(project=self.object)
-        page_size = settings.PROJECT_VERSION_LIST_SIZE
         context['versions'] = Version.objects.filter(
-            project=self.object).order_by('-padded_version')[:page_size]
+            project=self.object).order_by('-padded_version')[:5]
         context['sponsors'] = \
             SponsorshipPeriod.objects.filter(
                 project=self.object).order_by('-sponsorship_level__value')


Test patch:
Repository: kartoza/prj.app

Issue:
We need to update the landing page
With the recent work to create project pages, the landing page now contains superfluous content. Please update it to remove the changelog entries so that it becomes a project gallery. Clicking into a project will go to the project landing page. From the project landing page the user can then go into their changelogs etc.


Discussion:

Resolving patch:
diff --git a/django_project/base/views/project.py b/django_project/base/views/project.py
--- a/django_project/base/views/project.py
+++ b/django_project/base/views/project.py
@@ -134,6 +134,9 @@ def get_context_data(self, **kwargs):
             SponsorshipPeriod.objects.filter(
                 project=self.object).order_by('-sponsorship_level__value')
         context['screenshots'] = self.object.screenshots.all()
+        context['organisations'] = \
+            CertifyingOrganisation.objects.filter(
+                project=self.object, approved=True)
         return context
 
     def get_queryset(self):


Test patch:
Repository: kartoza/prj.app

Issue:
show actual amount sponsored next to each organisation name
In the sponsorship periods view, it would be good to show actual amount sponsored next to each organisation name


Discussion:

Resolving patch:
diff --git a/django_project/changes/views/sponsorship_period.py b/django_project/changes/views/sponsorship_period.py
--- a/django_project/changes/views/sponsorship_period.py
+++ b/django_project/changes/views/sponsorship_period.py
@@ -133,8 +133,10 @@ def get_context_data(self, **kwargs):
         """
         context = super(SponsorshipPeriodListView,
                         self).get_context_data(**kwargs)
+        project_slug = self.kwargs.get('project_slug', None)
+        project = Project.objects.get(slug=project_slug)
         context['num_sponsorshipperiods'] = \
-            context['sponsorshipperiods'].count()
+            SponsorshipPeriod.objects.filter(project=project).count()
         context['unapproved'] = False
         project_slug = self.kwargs.get('project_slug', None)
         context['project_slug'] = project_slug
@@ -160,6 +162,16 @@ def get_queryset(self, queryset=None):
                     SponsorshipPeriod.objects.filter(
                         project=project).order_by(
                         '-sponsorship_level__value', '-end_date')
+
+                # Retrofill amount sponsored with sponsorship level value
+                # when it is not available
+                for index, item in enumerate(queryset):
+                    if not queryset[index].amount_sponsored:
+                        queryset[index].amount_sponsored = \
+                            queryset[index].sponsorship_level.value
+                        queryset[index].currency = \
+                            queryset[index].sponsorship_level.currency
+                        queryset[index].save()
                 return queryset
             else:
                 raise Http404('Sorry! We could not find your Sponsor Period!')


Test patch:
Repository: kartoza/prj.app

Issue:
We need an about page for certification
It should be a jinja template where Tim can add extended content.

-[ ] Content should be translatable
-[ ] there should be a link to the about page on the new certification organisation registration page.


Discussion:

Resolving patch:
diff --git a/django_project/certification/urls.py b/django_project/certification/urls.py
--- a/django_project/certification/urls.py
+++ b/django_project/certification/urls.py
@@ -55,12 +55,20 @@
 
     # Validate Certificate.
     ValidateCertificate,
+
+    # About.
+    AboutView,
 )
 
 
 urlpatterns = patterns(
     '',
 
+    # About page
+    url(regex='^(?P<project_slug>[\w-]+)/about/$',
+        view=AboutView.as_view(),
+        name='about'),
+
     # Certifying Organisation management
     url(regex='^(?P<project_slug>[\w-]+)/pending-certifyingorganisation/'
               'list/$',
diff --git a/django_project/certification/views/certifying_organisation.py b/django_project/certification/views/certifying_organisation.py
--- a/django_project/certification/views/certifying_organisation.py
+++ b/django_project/certification/views/certifying_organisation.py
@@ -12,7 +12,8 @@
     DeleteView,
     DetailView,
     UpdateView,
-    RedirectView)
+    RedirectView,
+    TemplateView)
 from django.http import HttpResponseRedirect, Http404
 from django.db import IntegrityError
 from django.core.exceptions import ValidationError
@@ -409,6 +410,7 @@ def get_context_data(self, **kwargs):
             CertifyingOrganisationCreateView, self).get_context_data(**kwargs)
         context['certifyingorganisations'] = \
             self.get_queryset().filter(project=self.project)
+        context['the_project'] = self.project
         return context
 
     def form_valid(self, form):
@@ -509,6 +511,7 @@ def get_context_data(self, **kwargs):
             CertifyingOrganisationUpdateView, self).get_context_data(**kwargs)
         context['certifyingorganisations'] = self.get_queryset() \
             .filter(project=self.project)
+        context['the_project'] = self.project
         return context
 
     def get_queryset(self):
@@ -657,3 +660,22 @@ def get_redirect_url(self, project_slug, slug):
         return reverse(self.pattern_name, kwargs={
             'project_slug': project_slug
         })
+
+
+class AboutView(TemplateView):
+    template_name = 'about.html'
+
+    def get_context_data(self, **kwargs):
+        """Get the context data which is passed to a template.
+
+        :param kwargs: Any arguments to pass to the superclass.
+        :type kwargs: dict
+
+        :returns: Context data which will be passed to the template.
+        :rtype: dict
+        """
+
+        context = super(AboutView, self).get_context_data(**kwargs)
+        project_slug = self.kwargs.get('project_slug')
+        context['the_project'] = Project.objects.get(slug=project_slug)
+        return context


Test patch:
Repository: kartoza/prj.app

Issue:
500 on sponsor RSS feed
http://staging.changelog.qgis.org/en/qgis/sponsor/rss/

(I was not logged in)

Also can you  make the feed discoverable - adding an RSS and Atom link at the top of the sponsors listing pages would be good...


Discussion:
```
root@staging /home/projecta/deployment # tail -f logs/uwsgi-errors.log 
                                                          u'filename': u'django/views/generic/base.py',
                                                          u'function': u'dispatch',
                                                          u'in_app': False,
                                                          u'lineno': 89,
                                                          u'module': u'django.views.generic.base',
                                                          u'post_context': [u'',
                                                                            u'    def http_method_not_allowed(self, request, *args, **kwargs):',
                                                                            u"        logger.warning('Method Not Allowed (%s): %s', request.method, request.path,",
                                                                            u'            extra={',
                                                                            u"                'status_code': 405,"],ERROR 2017-10-24 10:35:53,856 base 433 140614223537920 [u'DoesNotExist: SponsorshipPeriod matching query does not exist.', u'  File "django/core/handlers/base.py", line 132, in get_response', u'  File "django/views/generic/base.py", line 71, in view', u'  File "django/views/generic/base.py", line 89, in dispatch', u'  File "django/views/generic/detail.py", line 115, in get', u'  File "changes/views/sponsor.py", line 262, in get_object', u'  File "django/db/models/query.py", line 334, in get']
```
Hi @timlinux try this
http://staging.changelog.qgis.org/en/qgis/sponsor/rss

I'll add the icons

Resolving patch:
diff --git a/django_project/changes/urls.py b/django_project/changes/urls.py
--- a/django_project/changes/urls.py
+++ b/django_project/changes/urls.py
@@ -208,10 +208,10 @@
         name='entry-atom-feed'),
 
     # Feeds sponsors in a specific project
-    url(regex='^(?P<project_slug>[\w-]+)/sponsor/rss$',
+    url(regex='^(?P<project_slug>[\w-]+)/sponsors/rss/$',
         view=RssSponsorFeed(),
         name='sponsor-rss-feed'),
-    url(regex='^(?P<project_slug>[\w-]+)/sponsor/atom$',
+    url(regex='^(?P<project_slug>[\w-]+)/sponsors/atom/$',
         view=AtomSponsorFeed(),
         name='sponsor-atom-feed'),
 


Test patch:
Repository: kartoza/prj.app

Issue:
When the certifying organisation application is approved we should email the applicant
The applicant should be sent an email saying their organisation is now live and that they can start creating courses etc. Include a link to the about page.


Discussion:

Resolving patch:
diff --git a/django_project/certification/views/certifying_organisation.py b/django_project/certification/views/certifying_organisation.py
--- a/django_project/certification/views/certifying_organisation.py
+++ b/django_project/certification/views/certifying_organisation.py
@@ -652,6 +652,42 @@ def get_redirect_url(self, project_slug, slug):
             get_object_or_404(certifyingorganisation_qs, slug=slug)
         certifyingorganisation.approved = True
         certifyingorganisation.save()
+
+        site = self.request.get_host()
+        for organisation_owner in \
+                certifyingorganisation.organisation_owners.all():
+            data = {
+                'owner_firstname': organisation_owner.first_name,
+                'owner_lastname': organisation_owner.last_name,
+                'organisation_name': certifyingorganisation.name,
+                'project_name': certifyingorganisation.project.name,
+                'project_owner_firstname':
+                    certifyingorganisation.project.owner.first_name,
+                'project_owner_lastname':
+                    certifyingorganisation.project.owner.last_name,
+                'site': site,
+                'project_slug': project_slug,
+            }
+            send_mail(
+                'Projecta - Your organisation is approved',
+                'Dear {owner_firstname} {owner_lastname},\n\n'
+                'Congratulations!\n'
+                'Your certifying organisation has been approved. The following'
+                ' is the details of the newly approved organisation:\n'
+                'Name of organisation: {organisation_name}\n'
+                'Project: {project_name}\n'
+                'You may now start creating your training center, '
+                'course type, course convener and course.\n'
+                'For further information please visit: '
+                '{site}/en/{project_slug}/about/\n\n'
+                'Sincerely,\n'
+                '{project_owner_firstname} {project_owner_lastname}'
+                .format(**data),
+                certifyingorganisation.project.owner.email,
+                [organisation_owner.email],
+                fail_silently=False,
+            )
+
         return reverse(self.pattern_name, kwargs={
             'project_slug': project_slug
         })


Test patch:
Repository: kartoza/prj.app

Issue:
We need to email the applicant of a certifying organisation on submit
When the user submits his/her certifying organisation request to teh queue, they should be sent an automatic email explaining what will happen next in the process. This should include the contact details of the project manager who will review they application and a link to the certification about page.



Discussion:

Resolving patch:
diff --git a/django_project/certification/views/certifying_organisation.py b/django_project/certification/views/certifying_organisation.py
--- a/django_project/certification/views/certifying_organisation.py
+++ b/django_project/certification/views/certifying_organisation.py
@@ -445,6 +445,41 @@ def form_valid(self, form):
                 [self.project.owner.email],
                 fail_silently=False,
             )
+
+            contact_person = \
+                '{} {}: {}\n'.format(
+                    self.project.owner.first_name,
+                    self.project.owner.last_name,
+                    self.project.owner.email)
+
+            for manager in self.project.certification_manager.all():
+                contact_person += \
+                    '{} {}: {}\n'.format(
+                        manager.first_name, manager.last_name, manager.email)
+
+            # Email the applicant notify that the organisation is successfully
+            # submitted.
+            for applicant in self.object.organisation_owners.all():
+                email_data = {
+                    'applicant_firstname': applicant.first_name,
+                    'applicant_lastname': applicant.last_name,
+                    'contact_person': contact_person,
+                }
+
+                send_mail(
+                    'Projecta - Your Organisation is Successfully Submitted',
+                    'Dear {applicant_firstname} {applicant_lastname},\n\n'
+                    'Your organisation is successfully submitted.\n'
+                    'It is now waiting for an approval from the project\'s '
+                    'owner and certification managers.\n'
+                    'If you have not heard from us in few weeks you may '
+                    'contact us:\n'
+                    '{contact_person}'
+                    '\n\nSincerely,\n'.format(**email_data),
+                    self.project.owner.email,
+                    [applicant.email]
+                )
+
             return HttpResponseRedirect(self.get_success_url())
         except IntegrityError:
             return ValidationError(


Test patch:
Repository: kartoza/prj.app

Issue:
Make the field length for sponsorship programme longer
Trying to paste in long content into the QGIS sponsorship programme fails - please fix by making the field length larger


Discussion:

Resolving patch:
diff --git a/django_project/base/migrations/0010_auto_20171027_0525.py b/django_project/base/migrations/0010_auto_20171027_0525.py
new file mode 100644
--- /dev/null
+++ b/django_project/base/migrations/0010_auto_20171027_0525.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('base', '0009_project_certification_manager'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='project',
+            name='sponsorship_programme',
+            field=models.TextField(help_text='Sponsorship programme for this project. Markdown is supported', max_length=10000, null=True, blank=True),
+        ),
+    ]
diff --git a/django_project/base/models/project.py b/django_project/base/models/project.py
--- a/django_project/base/models/project.py
+++ b/django_project/base/models/project.py
@@ -143,7 +143,7 @@ class Project(models.Model):
     sponsorship_programme = models.TextField(
         help_text=_(
             'Sponsorship programme for this project. Markdown is supported'),
-        max_length=3000,
+        max_length=10000,
         blank=True,
         null=True
     )


Test patch: