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

Issue:
Lesson table should support markdown in cells
I would like to be able to bold certain words or otherwise use Markdown to embellish content in the specification table.

![screen shot 2018-03-09 at 16 27 56](https://user-images.githubusercontent.com/178003/37212329-6db69252-23b7-11e8-881c-167f01c9dd80.png)


For example I want to make the word 'Algorithm' in the above image bold by doing ``**Algorithm**``.

Please run table text through the markdown filter.


Discussion:

Resolving patch:
diff --git a/django_project/lesson/migrations/0025_auto_20180313_0955.py b/django_project/lesson/migrations/0025_auto_20180313_0955.py
new file mode 100644
--- /dev/null
+++ b/django_project/lesson/migrations/0025_auto_20180313_0955.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('lesson', '0024_auto_20180312_1726'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='specification',
+            name='title',
+            field=models.CharField(help_text='Title of specification. Markdown is supported', max_length=200),
+        ),
+        migrations.AlterField(
+            model_name='specification',
+            name='title_en',
+            field=models.CharField(help_text='Title of specification. Markdown is supported', max_length=200, null=True),
+        ),
+        migrations.AlterField(
+            model_name='specification',
+            name='title_ind',
+            field=models.CharField(help_text='Title of specification. Markdown is supported', max_length=200, null=True),
+        ),
+        migrations.AlterField(
+            model_name='specification',
+            name='value',
+            field=models.CharField(help_text='Value of specification. Markdown is supported', max_length=200),
+        ),
+        migrations.AlterField(
+            model_name='specification',
+            name='value_en',
+            field=models.CharField(help_text='Value of specification. Markdown is supported', max_length=200, null=True),
+        ),
+        migrations.AlterField(
+            model_name='specification',
+            name='value_ind',
+            field=models.CharField(help_text='Value of specification. Markdown is supported', max_length=200, null=True),
+        ),
+    ]
diff --git a/django_project/lesson/models/specification.py b/django_project/lesson/models/specification.py
--- a/django_project/lesson/models/specification.py
+++ b/django_project/lesson/models/specification.py
@@ -37,14 +37,14 @@ class Specification(TranslationMixin):
     )
 
     title = models.CharField(
-        help_text=_('Title of specification.'),
+        help_text=_('Title of specification. Markdown is supported'),
         blank=False,
         null=False,
         max_length=200,
     )
 
     value = models.CharField(
-        help_text=_('Value of specification.'),
+        help_text=_('Value of specification. Markdown is supported'),
         blank=False,
         null=False,
         max_length=200,


Test patch:
Repository: kartoza/prj.app

Issue:
No way to see approval requests for new projects
When a new project is registered, there is no convenient link for an admin to see. Maybe we should just approve it by default.....


Discussion:

Resolving patch:
diff --git a/django_project/base/forms.py b/django_project/base/forms.py
--- a/django_project/base/forms.py
+++ b/django_project/base/forms.py
@@ -147,6 +147,7 @@ def __init__(self, *args, **kwargs):
 
     def save(self, commit=True):
         instance = super(ProjectForm, self).save(commit=False)
+        instance.approved = True
         instance.owner = self.user
         instance.save()
         self.save_m2m()
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
@@ -186,7 +186,7 @@ class ProjectCreateView(LoginRequiredMixin, ProjectMixin, CreateView):
     template_name = 'project/create.html'
 
     def get_success_url(self):
-        return reverse('pending-project-list')
+        return reverse('home')
 
     def get_form_kwargs(self):
         kwargs = super(ProjectCreateView, self).get_form_kwargs()


Test patch:
diff --git a/django_project/base/tests/test_views.py b/django_project/base/tests/test_views.py
--- a/django_project/base/tests/test_views.py
+++ b/django_project/base/tests/test_views.py
@@ -81,7 +81,7 @@ def test_ProjectCreate_with_login(self):
             'organisation': self.test_organisation.id,
         }
         response = client.post(reverse('project-create'), post_data)
-        self.assertRedirects(response, reverse('pending-project-list'))
+        self.assertRedirects(response, reverse('home'))
 
     @override_settings(VALID_DOMAIN=['testserver', ])
     def test_ProjectCreate_no_login(self):
Repository: kartoza/prj.app

Issue:
Error 500 when trying to print a certificate
This error produces when I try to print a new certificate or regenerate it.

If you need assistance, you may reference this error as e5bcad001ba1496c9f4bcf447afea2f9.


Discussion:
Can you fix this ASAP @ann26 ? Its probably this:

http://sentry.kartoza.com/sentry/projecta/issues/93/

@AurelioMorales My apologies for the delay in noticing your ticket!

Regards

Tim

Resolving patch:
diff --git a/django_project/certification/models/course_convener.py b/django_project/certification/models/course_convener.py
--- a/django_project/certification/models/course_convener.py
+++ b/django_project/certification/models/course_convener.py
@@ -13,6 +13,7 @@
 from core.settings.contrib import STOP_WORDS
 from unidecode import unidecode
 from certifying_organisation import CertifyingOrganisation
+from certification.utilities import check_slug
 
 
 class CourseConvener(models.Model):
@@ -60,7 +61,9 @@ def save(self, *args, **kwargs):
         # unidecode() represents special characters (unicode data) in ASCII
         new_list = '%s-%s' % \
                    (self.user.username, unidecode(' '.join(filtered_words)))
-        self.slug = slugify(new_list)[:50]
+        new_slug = slugify(new_list)[:50]
+        new_slug = check_slug(CourseConvener.objects.all(), new_slug)
+        self.slug = slugify(new_slug)[:50]
         super(CourseConvener, self).save(*args, **kwargs)
 
     def __unicode__(self):
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
@@ -214,11 +214,15 @@ def generate_pdf(
 
     if course.course_convener.title:
         convener_name = \
-            '{} {}'.format(course.course_convener.title, convener_name)
+            '{} {}'.format(
+                course.course_convener.title.encode('utf-8'),
+                convener_name)
 
     if course.course_convener.degree:
         convener_name = \
-            '{}, {}'.format(convener_name, course.course_convener.degree)
+            '{}, {}'.format(
+                convener_name,
+                course.course_convener.degree.encode('utf-8'))
 
     course_duration = \
         'From {} {} {} to {} {} {}'.format(


Test patch:
Repository: kartoza/prj.app

Issue:
Error 500 when trying to print a certificate
This error produces when I try to print a new certificate or regenerate it.

If you need assistance, you may reference this error as e5bcad001ba1496c9f4bcf447afea2f9.


Discussion:
Can you fix this ASAP @ann26 ? Its probably this:

http://sentry.kartoza.com/sentry/projecta/issues/93/

@AurelioMorales My apologies for the delay in noticing your ticket!

Regards

Tim
@ann26 I deployed to live but it seems the error is still there e.g.

http://changelog.qgis.org/en/qgis/certificate/QGIS-118/

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
@@ -151,14 +151,16 @@ def get_context_data(self, **kwargs):
             if certificate.course.course_convener.title:
                 convener_name = \
                     '{} {}'.format(
-                        certificate.course.course_convener.title,
+                        certificate.course.course_convener.title.encode(
+                            'utf-8'),
                         convener_name)
 
             if certificate.course.course_convener.degree:
                 convener_name = \
                     '{}, {}'.format(
                         convener_name,
-                        certificate.course.course_convener.degree)
+                        certificate.course.course_convener.degree.encode(
+                            'utf-8'))
 
             context['convener_name'] = convener_name
         context['project_slug'] = self.project_slug


Test patch:
Repository: kartoza/prj.app

Issue:
Display the version number in the footer
![screen shot 2018-03-06 at 11 22 17](https://user-images.githubusercontent.com/1609292/37027086-a8dd8482-2130-11e8-8c72-939dae625a64.png)

In the footer, next to "Available on github", we can display the version number from this file: https://github.com/kartoza/projecta/blob/develop/django_project/.version

To be able to know between staging and production which version we are running

Sentry is already reading this file: https://github.com/kartoza/projecta/blob/develop/django_project/core/settings/prod.py#L47


Discussion:

Resolving patch:
diff --git a/django_project/lesson/templatetags/lesson_tags.py b/django_project/lesson/templatetags/lesson_tags.py
--- a/django_project/lesson/templatetags/lesson_tags.py
+++ b/django_project/lesson/templatetags/lesson_tags.py
@@ -1,8 +1,9 @@
 # coding=utf-8
 """Custom tags for lesson app."""
-
 from django import template
 from django.utils.safestring import mark_safe
+from core.settings.utils import absolute_path
+
 
 register = template.Library()
 
@@ -14,3 +15,16 @@ def is_translation_up_to_date(value):
             '<span title="Translation is outdated"><sup>&#x2757;</sup></span>')
     else:
         return mark_safe('')
+
+
+@register.simple_tag(takes_context=True)
+def version_tag(context):
+    """Reads current project release from the .version file."""
+    version_file = absolute_path('.version')
+    try:
+        with open(version_file, 'r') as file:
+            version = file.read()
+            context['version'] = version
+    except IOError:
+        context['version'] = 'Unknown'
+    return context['version']


Test patch:
Repository: kartoza/prj.app

Issue:
Remove RST logic from version templates
See https://github.com/kartoza/prj.app/pull/934

Please go through all the templates that have RST logic in besides the ones introduced in #934 and remove the RST if blocks.

Then remove the old download view and replace the button in the ui to point to the downloadRST view introduced by @rduivenvoorde 


Discussion:
Please chat to me if you need details

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
@@ -32,7 +32,6 @@
     PendingVersionListView,
     ApproveVersionView,
     VersionDownload,
-    VersionDownloadRST,
     VersionDownloadGnu,
     VersionSponsorDownload,
     # Entry
@@ -150,9 +149,6 @@
     url(regex='^(?P<project_slug>[\w-]+)/version/(?P<slug>[\w.-]+)/download/$',
         view=VersionDownload.as_view(),
         name='version-download'),
-    url(regex='^(?P<project_slug>[\w-]+)/version/(?P<slug>[\w.-]+)/downloadrst/$',
-        view=VersionDownloadRST.as_view(),
-        name='version-download-rst'),
     url(regex='^(?P<project_slug>[\w-]+)/version/(?P<slug>[\w.-]+)/gnu/$',
         view=VersionDownloadGnu.as_view(),
         name='version-download-gnu'),
diff --git a/django_project/changes/views/version.py b/django_project/changes/views/version.py
--- a/django_project/changes/views/version.py
+++ b/django_project/changes/views/version.py
@@ -637,7 +637,7 @@ def get_redirect_url(self, project_slug, slug):
 
 class VersionDownload(CustomStaffuserRequiredMixin, VersionMixin, DetailView):
     """View to allow staff users to download Version page in RST format."""
-    template_name = 'version/detail-content.html'
+    template_name = 'version/detail-content-rst.html'
 
     def get_context_data(self, **kwargs):
         """Get the context data which is passed to a template.
@@ -741,11 +741,6 @@ def _prepare_zip_archive(self, document, version_obj):
         return temp_path
 
 
-class VersionDownloadRST(VersionDownload):
-    """View to allow staff users to download Version page in RST format."""
-    template_name = 'version/detail-content-rst.html'
-
-
 class VersionDownloadGnu(VersionMixin, DetailView):
     """A tabular list style view for a Version."""
     context_object_name = 'version'


Test patch:
Repository: kartoza/prj.app

Issue:
Person name shows as black block in certificate
See http://changelog.qgis.org/en/qgis/certifyingorganisation/qgis-cracow-university-of-technology/course/qgis_spatial-information-systems-ii_2018-02-26-2018-06-22/print/248/

<img width="1555" alt="screen shot 2018-06-14 at 20 00 01" src="https://user-images.githubusercontent.com/178003/41429913-d5e7c80c-700e-11e8-9816-42dce46dba3e.png">

CC @Cracert 

@Cracert sorry it is a holiday in Indonesia - I will get Anita to fix it when she gets back online.


Discussion:
Thank you @timlinux for this information.

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
@@ -11,6 +11,7 @@
 from django.core.mail import send_mail
 from django.http import Http404, HttpResponse, HttpResponseRedirect
 from django.views.generic import CreateView, DetailView
+from django.conf import settings
 from django.core.urlresolvers import reverse
 from django.db import IntegrityError
 from django.core.exceptions import ValidationError
@@ -19,6 +20,8 @@
 from reportlab.pdfgen import canvas
 from reportlab.lib.pagesizes import A4, landscape
 from reportlab.lib.utils import ImageReader
+from reportlab.pdfbase import pdfmetrics
+from reportlab.pdfbase.ttfonts import TTFont, TTFError
 from ..models import (
     Certificate,
     Course,
@@ -221,6 +224,15 @@ def generate_pdf(
         pathname, project, course, attendee, certificate, current_site):
     """Create the PDF object, using the response object as its file."""
 
+    # Register new font
+    try:
+        font_folder = os.path.join(
+            settings.STATIC_ROOT, 'fonts/NotoSans-hinted')
+        ttf_file = os.path.join(font_folder, 'NotoSans-Bold.ttf')
+        pdfmetrics.registerFont(TTFont('Noto-bold', ttf_file))
+    except TTFError:
+        pass
+
     page = canvas.Canvas(pathname, pagesize=landscape(A4))
     width, height = A4
     center = height * 0.5
@@ -309,6 +321,12 @@ def generate_pdf(
 
     page.setFont('Times-Bold', 26)
     page.drawCentredString(center, 480, 'Certificate of Completion')
+
+    try:
+        page.setFont('Noto-bold', 26)
+    except KeyError:
+        page.setFont('Times-Bold', 26)
+
     page.drawCentredString(
         center, 400, '%s %s' % (
             attendee.firstname.encode('utf-8'),


Test patch:
Repository: kartoza/prj.app

Issue:
http:// must be added manually
If in founder URL of an changelog entry, the URL is 'www.something.com', the link is wrong. The user must add 'https://' to make it work properly. I think projecta should handle this ? It might be the same issue in developer URL.


Discussion:
Thanks @Gustry - another one for you @sonlinux !

Resolving patch:
diff --git a/django_project/changes/forms.py b/django_project/changes/forms.py
--- a/django_project/changes/forms.py
+++ b/django_project/changes/forms.py
@@ -1,5 +1,6 @@
 # coding=utf-8
 from django import forms
+from django.forms.widgets import TextInput
 from django.core.validators import ValidationError
 from crispy_forms.helper import FormHelper
 from crispy_forms.layout import (
@@ -144,6 +145,10 @@ def __init__(self, *args, **kwargs):
         super(EntryForm, self).__init__(*args, **kwargs)
         self.helper.add_input(Submit('submit', 'Submit'))
         self.fields['title'].label = 'Feature Title'
+        self.fields['funder_url'] = forms.URLField(
+                initial="http://", widget=TextInput)
+        self.fields['developer_url'] = forms.URLField(
+                initial="http://", widget=TextInput)
         # Filter the category list when editing so it shows only relevant ones
         self.fields['category'].queryset = Category.objects.filter(
             project=self.project).order_by('name')


Test patch:
diff --git a/django_project/changes/tests/test_views.py b/django_project/changes/tests/test_views.py
--- a/django_project/changes/tests/test_views.py
+++ b/django_project/changes/tests/test_views.py
@@ -355,10 +355,7 @@ def test_EntryCreate_with_login(self):
             'project_slug': self.project.slug,
             'version_slug': self.version.slug
         }), post_data)
-        self.assertRedirects(
-            response, reverse('version-detail', kwargs={
-                'project_slug': self.project.slug,
-                'slug': self.version.slug}))
+        self.assertEqual(response.status_code, 200)
 
     @override_settings(VALID_DOMAIN=['testserver', ])
     def test_EntryCreate_no_login(self):
@@ -408,10 +405,7 @@ def test_EntryUpdate_with_login(self):
         response = self.client.post(reverse('entry-update', kwargs={
             'pk': self.entry.id
         }), post_data)
-        self.assertRedirects(
-            response, reverse('version-detail', kwargs={
-                'project_slug': self.project.slug,
-                'slug': self.version.slug}))
+        self.assertEqual(response.status_code, 200)
 
     @override_settings(VALID_DOMAIN=['testserver', ])
     def test_EntryUpdate_no_login(self):
Repository: kartoza/prj.app

Issue:
Unable to edit changelog description
<jef> is unable to edit the main changelog description (no pencil above the entry). He is a changelog manager - can you please check why this is?

<img width="1190" alt="screenshot 2018-11-05 at 22 31 08" src="https://user-images.githubusercontent.com/178003/48024905-92b58800-e14a-11e8-9c77-906dee18a11e.png">


CC @jef-n


Discussion:

Resolving patch:
diff --git a/django_project/changes/views/version.py b/django_project/changes/views/version.py
--- a/django_project/changes/views/version.py
+++ b/django_project/changes/views/version.py
@@ -180,8 +180,7 @@ def get_context_data(self, **kwargs):
             context['user_can_edit'] = True
             context['user_can_delete'] = True
 
-        if context['project'].changelog_managers.filter(
-                project__owner=self.request.user.id).exists():
+        if self.request.user in context['project'].changelog_managers.all():
             context['user_can_edit'] = True
             context['user_can_delete'] = True
 
@@ -388,7 +387,7 @@ def get_queryset(self):
                 Q(project=project) &
                 (Q(author=self.request.user) |
                  Q(project__owner=self.request.user) |
-                 Q(project__changelog_managers=self.request.user)))
+                 Q(project__changelog_managers=self.request.user))).distinct()
 
 
 # noinspection PyAttributeOutsideInit
@@ -481,7 +480,7 @@ def get_queryset(self):
             versions_qs = versions_qs.filter(
                 (Q(author=self.request.user) |
                  Q(project__owner=self.request.user) |
-                 Q(project__changelog_managers=self.request.user)))
+                 Q(project__changelog_managers=self.request.user))).distinct()
         return versions_qs
 
     def get_success_url(self):


Test patch:
Repository: kartoza/prj.app

Issue:
Voting options are still shown on closed ballots
Even if a ballot is closed

![image](https://user-images.githubusercontent.com/590385/62072292-a48e0c80-b23e-11e9-911e-5c1e4326477c.png)

I still see the voting options and a submit button:

![image](https://user-images.githubusercontent.com/590385/62072273-9cce6800-b23e-11e9-812e-a436e00a2a45.png)



Discussion:

Resolving patch:
diff --git a/django_project/vota/models/ballot.py b/django_project/vota/models/ballot.py
--- a/django_project/vota/models/ballot.py
+++ b/django_project/vota/models/ballot.py
@@ -19,6 +19,7 @@
 from vota.models.vote import Vote
 import datetime
 from django.contrib.auth.models import User
+from certification.utilities import check_slug
 
 logger = logging.getLogger(__name__)
 
@@ -150,7 +151,9 @@ def save(self, *args, **kwargs):
             words = self.name.split()
             filtered_words = [t for t in words if t.lower() not in STOP_WORDS]
             new_list = ' '.join(filtered_words)
-            self.slug = slugify(new_list)[:50]
+            new_slug = slugify(new_list)[:50]
+            new_slug = check_slug(Ballot.objects.all(), new_slug)
+            self.slug = slugify(new_slug)[:50]
         super(Ballot, self).save(*args, **kwargs)
 
     def __unicode__(self):
diff --git a/django_project/vota/views/ballot.py b/django_project/vota/views/ballot.py
--- a/django_project/vota/views/ballot.py
+++ b/django_project/vota/views/ballot.py
@@ -14,7 +14,7 @@
 from django.core.exceptions import ValidationError
 from base.models import Project
 from vota.forms import BallotCreateForm
-from vota.models import Ballot, Committee
+from vota.models import Ballot, Committee, Vote, VOTE_CHOICES
 
 logger = logging.getLogger(__name__)
 
@@ -32,6 +32,12 @@ def get_context_data(self, **kwargs):
         context = super(BallotDetailView, self).get_context_data(**kwargs)
         context['committee'] = Committee.objects.get(
             id=self.object.committee.id)
+        try:
+            vote = Vote.objects.get(user=self.request.user, ballot=self.object)
+            context['vote'] = dict(VOTE_CHOICES).get(vote.choice)
+        except Vote.DoesNotExist:
+            pass
+
         return context
 
     def get_queryset(self):


Test patch:
Repository: kartoza/prj.app

Issue:
Show who voted how on ballots
For the QGIS PSC voting, we need to see who voted how and not just how many people voted:

![image](https://user-images.githubusercontent.com/590385/62072146-4eb96480-b23e-11e9-96b3-38e60375d8c0.png)

Additionally, it would be good to automatically send reminders to people if they haven't voted and the closing date is coming up.



Discussion:

Resolving patch:
diff --git a/django_project/vota/models/vote.py b/django_project/vota/models/vote.py
--- a/django_project/vota/models/vote.py
+++ b/django_project/vota/models/vote.py
@@ -37,3 +37,6 @@ class Meta:
 
     def __unicode__(self):
         return u'%s : %s' % (self.ballot.name, self.user.username)
+
+    def get_choice(self):
+        return dict(VOTE_CHOICES).get(self.choice)
diff --git a/django_project/vota/views/ballot.py b/django_project/vota/views/ballot.py
--- a/django_project/vota/views/ballot.py
+++ b/django_project/vota/views/ballot.py
@@ -32,12 +32,12 @@ def get_context_data(self, **kwargs):
         context = super(BallotDetailView, self).get_context_data(**kwargs)
         context['committee'] = Committee.objects.get(
             id=self.object.committee.id)
+        context['all_votes'] = Vote.objects.filter(ballot=self.object)
         try:
             vote = Vote.objects.get(user=self.request.user, ballot=self.object)
             context['vote'] = dict(VOTE_CHOICES).get(vote.choice)
         except Vote.DoesNotExist:
             pass
-
         return context
 
     def get_queryset(self):


Test patch: