prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Course name
  Currently the course name is quite long, i.e. XProject_QGIS Introduction_2017-07-05-2017-07-19 
  
  Would it be better if we can have a shorter course name, i.e. QGIS Introduction 101?
  What do you think @timlinux ?
  
  --- 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/models/certifying_organisation.py`
  Content:
  ```
  1 # coding=utf-8
  2 """Certifying organisation model definitions for certification apps.
  3 
  4 """
  5 
  6 import os
  7 from django.conf.global_settings import MEDIA_ROOT
  8 from django.core.urlresolvers import reverse
  9 from django.core.exceptions import ValidationError
  10 from django.core.validators import validate_email
  11 from django.db import models
  12 from django.utils.text import slugify
  13 from django.utils.translation import ugettext_lazy as _
  14 from core.settings.contrib import STOP_WORDS
  15 from unidecode import unidecode
  16 from django.contrib.auth.models import User
  17 from django_countries.fields import CountryField
  18 import logging
  19 
  20 logger = logging.getLogger(__name__)
  21 
  22 
  23 class SlugifyingMixin(object):
  24 
  25     class Meta:
  26         abstract = True
  27 
  28     def save(self, *args, **kwargs):
  29         if not self.pk:
  30             words = self.name.split()
  31             filtered_words = [word for word in words if
  32                               word.lower() not in STOP_WORDS]
  33             # unidecode() represents special characters (unicode data) in ASCII
  34             new_list = unidecode(' '.join(filtered_words))
  35             self.slug = slugify(new_list)[:50]
  36         super(SlugifyingMixin, self).save(*args, **kwargs)
  37 
  38 
  39 class ApprovedCertifyingOrganisationManager(models.Manager):
  40     """Custom training centre manager.
  41 
  42     Shows only approved certifying organisation.
  43     """
  44 
  45     def get_queryset(self):
  46         """Query set generator. """
  47 
  48         return super(
  49             ApprovedCertifyingOrganisationManager, self).get_queryset().filter(
  50                 approved=True)
  51 
  52 
  53 class UnapprovedCertifyingOrganisationManager(models.Manager):
  54     """Custom training centre manager.
  55 
  56     Shows only unapproved certifying organisation.
  57     """
  58 
  59     def get_queryset(self):
  60         """Query set generator. """
  61 
  62         return super(
  63             UnapprovedCertifyingOrganisationManager, self).get_queryset(
  64         ).filter(approved=False)
  65 
  66 
  67 def validate_email_address(value):
  68     try:
  69         validate_email(value)
  70         return True
  71     except ValidationError(
  72             _('%(value)s is not a valid email address'),
  73             params={'value': value},):
  74         return False
  75 
  76 
  77 class CertifyingOrganisation(SlugifyingMixin, models.Model):
  78     """Certifying organisation model."""
  79 
  80     name = models.CharField(
  81         help_text=_('name of organisation or institution'),
  82         max_length=200,
  83         null=False,
  84         blank=False
  85     )
  86 
  87     organisation_email = models.CharField(
  88         help_text=_('Email address organisation or institution.'),
  89         max_length=200,
  90         null=False,
  91         blank=False,
  92         validators=[validate_email_address],
  93     )
  94 
  95     address = models.TextField(
  96         help_text=_('Address of Organisation or Institution.'),
  97         max_length=1000,
  98         null=False,
  99         blank=False
  100     )
  101 
  102     logo = models.ImageField(
  103         help_text=_('Logo for this organisation. '
  104                     'Most browsers support dragging the image directly on to '
  105                     'the "Choose File" button above.'),
  106         upload_to=os.path.join(MEDIA_ROOT, 'images/organisations'),
  107         blank=True
  108     )
  109 
  110     country = CountryField(
  111         help_text=_('Select the country for this Institution'),
  112         null=True,
  113         blank=True)
  114 
  115     organisation_phone = models.CharField(
  116         help_text=_('Phone number: (country code)(number) e.g. +6221551553'),
  117         max_length=200,
  118         null=False,
  119         blank=False
  120     )
  121 
  122     approved = models.BooleanField(
  123         help_text=_('Approval from project admin'),
  124         default=False
  125     )
  126 
  127     enabled = models.BooleanField(
  128         help_text=_('Project enabled'),
  129         default=True
  130     )
  131 
  132     slug = models.SlugField()
  133     organisation_owners = models.ManyToManyField(User)
  134     project = models.ForeignKey('base.Project')
  135     objects = models.Manager()
  136     approved_objects = ApprovedCertifyingOrganisationManager()
  137     unapproved_objects = UnapprovedCertifyingOrganisationManager()
  138 
  139     # noinspection PyClassicStyleClass.
  140     class Meta:
  141         """Meta class for Course attendee."""
  142 
  143         app_label = 'certification'
  144         ordering = ['name']
  145         unique_together = ['name', 'project']
  146 
  147     def save(self, *args, **kwargs):
  148         super(CertifyingOrganisation, self).save(*args, **kwargs)
  149 
  150     def __unicode__(self):
  151         return '%s - %s' % (self.project.name, self.name)
  152 
  153     def get_absolute_url(self):
  154         """Return URL to certifying organisation detail page.
  155 
  156         :return: URL
  157         :rtype: str
  158         """
  159         return reverse('certifying-organisation-detail', kwargs={
  160                 'slug': self.slug,
  161                 'project_slug': self.project.slug
  162         })
  163
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/django_project/certification/models/certifying_organisation.py b/django_project/certification/models/certifying_organisation.py
  --- a/django_project/certification/models/certifying_organisation.py
  +++ b/django_project/certification/models/certifying_organisation.py
  @@ -74,7 +74,7 @@
           return False
   
   
  -class CertifyingOrganisation(SlugifyingMixin, models.Model):
  +class CertifyingOrganisation(models.Model):
       """Certifying organisation model."""
   
       name = models.CharField(
  @@ -145,6 +145,15 @@
           unique_together = ['name', 'project']
   
       def save(self, *args, **kwargs):
  +        if not self.pk:
  +            words = self.name.split()
  +            filtered_words = [word for word in words if
  +                              word.lower() not in STOP_WORDS]
  +            # unidecode() represents special characters (unicode data) in ASCII
  +            new_list = \
  +                self.project.slug + ' ' + \
  +                unidecode(' '.join(filtered_words))
  +            self.slug = slugify(new_list)[:50]
           super(CertifyingOrganisation, self).save(*args, **kwargs)
   
       def __unicode__(self):
  
verification_info: {"golden_diff": "diff --git a/django_project/certification/models/certifying_organisation.py b/django_project/certification/models/certifying_organisation.py\n--- a/django_project/certification/models/certifying_organisation.py\n+++ b/django_project/certification/models/certifying_organisation.py\n@@ -74,7 +74,7 @@\n         return False\n \n \n-class CertifyingOrganisation(SlugifyingMixin, models.Model):\n+class CertifyingOrganisation(models.Model):\n     \"\"\"Certifying organisation model.\"\"\"\n \n     name = models.CharField(\n@@ -145,6 +145,15 @@\n         unique_together = ['name', 'project']\n \n     def save(self, *args, **kwargs):\n+        if not self.pk:\n+            words = self.name.split()\n+            filtered_words = [word for word in words if\n+                              word.lower() not in STOP_WORDS]\n+            # unidecode() represents special characters (unicode data) in ASCII\n+            new_list = \\\n+                self.project.slug + ' ' + \\\n+                unidecode(' '.join(filtered_words))\n+            self.slug = slugify(new_list)[:50]\n         super(CertifyingOrganisation, self).save(*args, **kwargs)\n \n     def __unicode__(self):\n", "issue": "Course name\nCurrently the course name is quite long, i.e. XProject_QGIS Introduction_2017-07-05-2017-07-19 \n\nWould it be better if we can have a shorter course name, i.e. QGIS Introduction 101?\nWhat do you think @timlinux ?\n", "before_files": [{"content": "# coding=utf-8\n\"\"\"Certifying organisation model definitions for certification apps.\n\n\"\"\"\n\nimport os\nfrom django.conf.global_settings import MEDIA_ROOT\nfrom django.core.urlresolvers import reverse\nfrom django.core.exceptions import ValidationError\nfrom django.core.validators import validate_email\nfrom django.db import models\nfrom django.utils.text import slugify\nfrom django.utils.translation import ugettext_lazy as _\nfrom core.settings.contrib import STOP_WORDS\nfrom unidecode import unidecode\nfrom django.contrib.auth.models import User\nfrom django_countries.fields import CountryField\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\nclass SlugifyingMixin(object):\n\n    class Meta:\n        abstract = True\n\n    def save(self, *args, **kwargs):\n        if not self.pk:\n            words = self.name.split()\n            filtered_words = [word for word in words if\n                              word.lower() not in STOP_WORDS]\n            # unidecode() represents special characters (unicode data) in ASCII\n            new_list = unidecode(' '.join(filtered_words))\n            self.slug = slugify(new_list)[:50]\n        super(SlugifyingMixin, self).save(*args, **kwargs)\n\n\nclass ApprovedCertifyingOrganisationManager(models.Manager):\n    \"\"\"Custom training centre manager.\n\n    Shows only approved certifying organisation.\n    \"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator. \"\"\"\n\n        return super(\n            ApprovedCertifyingOrganisationManager, self).get_queryset().filter(\n                approved=True)\n\n\nclass UnapprovedCertifyingOrganisationManager(models.Manager):\n    \"\"\"Custom training centre manager.\n\n    Shows only unapproved certifying organisation.\n    \"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator. \"\"\"\n\n        return super(\n            UnapprovedCertifyingOrganisationManager, self).get_queryset(\n        ).filter(approved=False)\n\n\ndef validate_email_address(value):\n    try:\n        validate_email(value)\n        return True\n    except ValidationError(\n            _('%(value)s is not a valid email address'),\n            params={'value': value},):\n        return False\n\n\nclass CertifyingOrganisation(SlugifyingMixin, models.Model):\n    \"\"\"Certifying organisation model.\"\"\"\n\n    name = models.CharField(\n        help_text=_('name of organisation or institution'),\n        max_length=200,\n        null=False,\n        blank=False\n    )\n\n    organisation_email = models.CharField(\n        help_text=_('Email address organisation or institution.'),\n        max_length=200,\n        null=False,\n        blank=False,\n        validators=[validate_email_address],\n    )\n\n    address = models.TextField(\n        help_text=_('Address of Organisation or Institution.'),\n        max_length=1000,\n        null=False,\n        blank=False\n    )\n\n    logo = models.ImageField(\n        help_text=_('Logo for this organisation. '\n                    'Most browsers support dragging the image directly on to '\n                    'the \"Choose File\" button above.'),\n        upload_to=os.path.join(MEDIA_ROOT, 'images/organisations'),\n        blank=True\n    )\n\n    country = CountryField(\n        help_text=_('Select the country for this Institution'),\n        null=True,\n        blank=True)\n\n    organisation_phone = models.CharField(\n        help_text=_('Phone number: (country code)(number) e.g. +6221551553'),\n        max_length=200,\n        null=False,\n        blank=False\n    )\n\n    approved = models.BooleanField(\n        help_text=_('Approval from project admin'),\n        default=False\n    )\n\n    enabled = models.BooleanField(\n        help_text=_('Project enabled'),\n        default=True\n    )\n\n    slug = models.SlugField()\n    organisation_owners = models.ManyToManyField(User)\n    project = models.ForeignKey('base.Project')\n    objects = models.Manager()\n    approved_objects = ApprovedCertifyingOrganisationManager()\n    unapproved_objects = UnapprovedCertifyingOrganisationManager()\n\n    # noinspection PyClassicStyleClass.\n    class Meta:\n        \"\"\"Meta class for Course attendee.\"\"\"\n\n        app_label = 'certification'\n        ordering = ['name']\n        unique_together = ['name', 'project']\n\n    def save(self, *args, **kwargs):\n        super(CertifyingOrganisation, self).save(*args, **kwargs)\n\n    def __unicode__(self):\n        return '%s - %s' % (self.project.name, self.name)\n\n    def get_absolute_url(self):\n        \"\"\"Return URL to certifying organisation detail page.\n\n        :return: URL\n        :rtype: str\n        \"\"\"\n        return reverse('certifying-organisation-detail', kwargs={\n                'slug': self.slug,\n                'project_slug': self.project.slug\n        })\n", "path": "django_project/certification/models/certifying_organisation.py"}], "after_files": [{"content": "# coding=utf-8\n\"\"\"Certifying organisation model definitions for certification apps.\n\n\"\"\"\n\nimport os\nfrom django.conf.global_settings import MEDIA_ROOT\nfrom django.core.urlresolvers import reverse\nfrom django.core.exceptions import ValidationError\nfrom django.core.validators import validate_email\nfrom django.db import models\nfrom django.utils.text import slugify\nfrom django.utils.translation import ugettext_lazy as _\nfrom core.settings.contrib import STOP_WORDS\nfrom unidecode import unidecode\nfrom django.contrib.auth.models import User\nfrom django_countries.fields import CountryField\nimport logging\n\nlogger = logging.getLogger(__name__)\n\n\nclass SlugifyingMixin(object):\n\n    class Meta:\n        abstract = True\n\n    def save(self, *args, **kwargs):\n        if not self.pk:\n            words = self.name.split()\n            filtered_words = [word for word in words if\n                              word.lower() not in STOP_WORDS]\n            # unidecode() represents special characters (unicode data) in ASCII\n            new_list = unidecode(' '.join(filtered_words))\n            self.slug = slugify(new_list)[:50]\n        super(SlugifyingMixin, self).save(*args, **kwargs)\n\n\nclass ApprovedCertifyingOrganisationManager(models.Manager):\n    \"\"\"Custom training centre manager.\n\n    Shows only approved certifying organisation.\n    \"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator. \"\"\"\n\n        return super(\n            ApprovedCertifyingOrganisationManager, self).get_queryset().filter(\n                approved=True)\n\n\nclass UnapprovedCertifyingOrganisationManager(models.Manager):\n    \"\"\"Custom training centre manager.\n\n    Shows only unapproved certifying organisation.\n    \"\"\"\n\n    def get_queryset(self):\n        \"\"\"Query set generator. \"\"\"\n\n        return super(\n            UnapprovedCertifyingOrganisationManager, self).get_queryset(\n        ).filter(approved=False)\n\n\ndef validate_email_address(value):\n    try:\n        validate_email(value)\n        return True\n    except ValidationError(\n            _('%(value)s is not a valid email address'),\n            params={'value': value},):\n        return False\n\n\nclass CertifyingOrganisation(models.Model):\n    \"\"\"Certifying organisation model.\"\"\"\n\n    name = models.CharField(\n        help_text=_('name of organisation or institution'),\n        max_length=200,\n        null=False,\n        blank=False\n    )\n\n    organisation_email = models.CharField(\n        help_text=_('Email address organisation or institution.'),\n        max_length=200,\n        null=False,\n        blank=False,\n        validators=[validate_email_address],\n    )\n\n    address = models.TextField(\n        help_text=_('Address of Organisation or Institution.'),\n        max_length=1000,\n        null=False,\n        blank=False\n    )\n\n    logo = models.ImageField(\n        help_text=_('Logo for this organisation. '\n                    'Most browsers support dragging the image directly on to '\n                    'the \"Choose File\" button above.'),\n        upload_to=os.path.join(MEDIA_ROOT, 'images/organisations'),\n        blank=True\n    )\n\n    country = CountryField(\n        help_text=_('Select the country for this Institution'),\n        null=True,\n        blank=True)\n\n    organisation_phone = models.CharField(\n        help_text=_('Phone number: (country code)(number) e.g. +6221551553'),\n        max_length=200,\n        null=False,\n        blank=False\n    )\n\n    approved = models.BooleanField(\n        help_text=_('Approval from project admin'),\n        default=False\n    )\n\n    enabled = models.BooleanField(\n        help_text=_('Project enabled'),\n        default=True\n    )\n\n    slug = models.SlugField()\n    organisation_owners = models.ManyToManyField(User)\n    project = models.ForeignKey('base.Project')\n    objects = models.Manager()\n    approved_objects = ApprovedCertifyingOrganisationManager()\n    unapproved_objects = UnapprovedCertifyingOrganisationManager()\n\n    # noinspection PyClassicStyleClass.\n    class Meta:\n        \"\"\"Meta class for Course attendee.\"\"\"\n\n        app_label = 'certification'\n        ordering = ['name']\n        unique_together = ['name', 'project']\n\n    def save(self, *args, **kwargs):\n        if not self.pk:\n            words = self.name.split()\n            filtered_words = [word for word in words if\n                              word.lower() not in STOP_WORDS]\n            # unidecode() represents special characters (unicode data) in ASCII\n            new_list = \\\n                self.project.slug + ' ' + \\\n                unidecode(' '.join(filtered_words))\n            self.slug = slugify(new_list)[:50]\n        super(CertifyingOrganisation, self).save(*args, **kwargs)\n\n    def __unicode__(self):\n        return '%s - %s' % (self.project.name, self.name)\n\n    def get_absolute_url(self):\n        \"\"\"Return URL to certifying organisation detail page.\n\n        :return: URL\n        :rtype: str\n        \"\"\"\n        return reverse('certifying-organisation-detail', kwargs={\n                'slug': self.slug,\n                'project_slug': self.project.slug\n        })\n", "path": "django_project/certification/models/certifying_organisation.py"}]}