prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Person plugin form list every pages, not only Person pages
  ## Bug Report
  
  **Expected behavior/code**
  Select box in PersonPlugin form should list only extended page with Person model.
  
  **Actual Behavior**
  Currently the select box is listing every CMS pages.
  
  **Steps to Reproduce**
  1. Edit a page;
  2. Try to add a Person plugin into a placeholder which allow it;
  3. Click to open the select box from opened form for added Person plugin.
  
  **Environment**
  - Richie version: 0.1.0 (from my own branch synchronized from master 200c8a3) 
  - Platform: Ubuntu 18.04 LTS
  
  **Possible Solution**
  Adding a filter inside plugin form machinery to retain only the extend page with Person.
  
  
  </issue>
  <code>
  [start of src/richie/apps/persons/models.py]
  1 """
  2 Declare and configure the model for the person application
  3 """
  4 from django.db import models
  5 from django.utils.translation import ugettext_lazy as _
  6 
  7 from cms.api import Page
  8 from cms.extensions import PageExtension
  9 from cms.models.pluginmodel import CMSPlugin
  10 from parler.models import TranslatableModel, TranslatedFields
  11 
  12 
  13 class PersonTitle(TranslatableModel):
  14     """
  15     PersonTitle define i18ned list of people titles and there abbreviations
  16     Instances of this models should only be created by CMS administrators
  17     """
  18 
  19     translations = TranslatedFields(
  20         title=models.CharField(_("Title"), max_length=200),
  21         abbreviation=models.CharField(_("Title abbreviation"), max_length=10),
  22     )
  23 
  24     class Meta:
  25         verbose_name = _("person title")
  26 
  27     def __str__(self):
  28         """Human representation of a person title"""
  29         return "{model}: {title} ({abbreviation})".format(
  30             model=self._meta.verbose_name.title(),
  31             title=self.title,
  32             abbreviation=self.abbreviation,
  33         )
  34 
  35 
  36 class Person(PageExtension):
  37     """
  38     The person page extension represents and records people information.
  39     It could be a course or news article author.
  40 
  41     This model should be used to record structured data about the person whereas the
  42     associated page object is where we record the less structured information to display on the
  43     page to present the person.
  44     """
  45 
  46     first_name = models.CharField(max_length=200, verbose_name=_("First name"))
  47     last_name = models.CharField(max_length=200, verbose_name=_("Last name"))
  48 
  49     person_title = models.ForeignKey("PersonTitle", related_name="persons")
  50 
  51     ROOT_REVERSE_ID = "persons"
  52     TEMPLATE_DETAIL = "persons/cms/person_detail.html"
  53 
  54     class Meta:
  55         verbose_name = _("person")
  56 
  57     def __str__(self):
  58         """Human representation of a person"""
  59         return "{model}: {title} ({full_name})".format(
  60             model=self._meta.verbose_name.title(),
  61             title=self.extended_object.get_title(),
  62             full_name=self.get_full_name(),
  63         )
  64 
  65     def save(self, *args, **kwargs):
  66         """
  67         Enforce validation on each instance save
  68         """
  69         self.full_clean()
  70         super().save(*args, **kwargs)
  71 
  72     def get_full_name(self):
  73         """
  74         Return person's full name
  75         """
  76         return "{person_title} {first_name} {last_name}".format(
  77             person_title=self.person_title.title,
  78             first_name=self.first_name,
  79             last_name=self.last_name,
  80         )
  81 
  82 
  83 class PersonPluginModel(CMSPlugin):
  84     """
  85     Person plugin model handles the relation from PersonPlugin
  86     to their Person instance
  87     """
  88 
  89     page = models.ForeignKey(Page)
  90 
  91     class Meta:
  92         verbose_name = _("person plugin model")
  93 
  94     def __str__(self):
  95         """Human representation of a person plugin"""
  96         return "{model:s}: {id:d}".format(
  97             model=self._meta.verbose_name.title(), id=self.id
  98         )
  99
  [end of src/richie/apps/persons/models.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/src/richie/apps/persons/models.py b/src/richie/apps/persons/models.py
  --- a/src/richie/apps/persons/models.py
  +++ b/src/richie/apps/persons/models.py
  @@ -86,7 +86,7 @@
       to their Person instance
       """
   
  -    page = models.ForeignKey(Page)
  +    page = models.ForeignKey(Page, limit_choices_to={"person__isnull": False})
   
       class Meta:
           verbose_name = _("person plugin model")
  
verification_info: {"golden_diff": "diff --git a/src/richie/apps/persons/models.py b/src/richie/apps/persons/models.py\n--- a/src/richie/apps/persons/models.py\n+++ b/src/richie/apps/persons/models.py\n@@ -86,7 +86,7 @@\n     to their Person instance\n     \"\"\"\n \n-    page = models.ForeignKey(Page)\n+    page = models.ForeignKey(Page, limit_choices_to={\"person__isnull\": False})\n \n     class Meta:\n         verbose_name = _(\"person plugin model\")\n", "issue": "Person plugin form list every pages, not only Person pages\n## Bug Report\r\n\r\n**Expected behavior/code**\r\nSelect box in PersonPlugin form should list only extended page with Person model.\r\n\r\n**Actual Behavior**\r\nCurrently the select box is listing every CMS pages.\r\n\r\n**Steps to Reproduce**\r\n1. Edit a page;\r\n2. Try to add a Person plugin into a placeholder which allow it;\r\n3. Click to open the select box from opened form for added Person plugin.\r\n\r\n**Environment**\r\n- Richie version: 0.1.0 (from my own branch synchronized from master 200c8a3) \r\n- Platform: Ubuntu 18.04 LTS\r\n\r\n**Possible Solution**\r\nAdding a filter inside plugin form machinery to retain only the extend page with Person.\r\n\n", "before_files": [{"content": "\"\"\"\nDeclare and configure the model for the person application\n\"\"\"\nfrom django.db import models\nfrom django.utils.translation import ugettext_lazy as _\n\nfrom cms.api import Page\nfrom cms.extensions import PageExtension\nfrom cms.models.pluginmodel import CMSPlugin\nfrom parler.models import TranslatableModel, TranslatedFields\n\n\nclass PersonTitle(TranslatableModel):\n    \"\"\"\n    PersonTitle define i18ned list of people titles and there abbreviations\n    Instances of this models should only be created by CMS administrators\n    \"\"\"\n\n    translations = TranslatedFields(\n        title=models.CharField(_(\"Title\"), max_length=200),\n        abbreviation=models.CharField(_(\"Title abbreviation\"), max_length=10),\n    )\n\n    class Meta:\n        verbose_name = _(\"person title\")\n\n    def __str__(self):\n        \"\"\"Human representation of a person title\"\"\"\n        return \"{model}: {title} ({abbreviation})\".format(\n            model=self._meta.verbose_name.title(),\n            title=self.title,\n            abbreviation=self.abbreviation,\n        )\n\n\nclass Person(PageExtension):\n    \"\"\"\n    The person page extension represents and records people information.\n    It could be a course or news article author.\n\n    This model should be used to record structured data about the person whereas the\n    associated page object is where we record the less structured information to display on the\n    page to present the person.\n    \"\"\"\n\n    first_name = models.CharField(max_length=200, verbose_name=_(\"First name\"))\n    last_name = models.CharField(max_length=200, verbose_name=_(\"Last name\"))\n\n    person_title = models.ForeignKey(\"PersonTitle\", related_name=\"persons\")\n\n    ROOT_REVERSE_ID = \"persons\"\n    TEMPLATE_DETAIL = \"persons/cms/person_detail.html\"\n\n    class Meta:\n        verbose_name = _(\"person\")\n\n    def __str__(self):\n        \"\"\"Human representation of a person\"\"\"\n        return \"{model}: {title} ({full_name})\".format(\n            model=self._meta.verbose_name.title(),\n            title=self.extended_object.get_title(),\n            full_name=self.get_full_name(),\n        )\n\n    def save(self, *args, **kwargs):\n        \"\"\"\n        Enforce validation on each instance save\n        \"\"\"\n        self.full_clean()\n        super().save(*args, **kwargs)\n\n    def get_full_name(self):\n        \"\"\"\n        Return person's full name\n        \"\"\"\n        return \"{person_title} {first_name} {last_name}\".format(\n            person_title=self.person_title.title,\n            first_name=self.first_name,\n            last_name=self.last_name,\n        )\n\n\nclass PersonPluginModel(CMSPlugin):\n    \"\"\"\n    Person plugin model handles the relation from PersonPlugin\n    to their Person instance\n    \"\"\"\n\n    page = models.ForeignKey(Page)\n\n    class Meta:\n        verbose_name = _(\"person plugin model\")\n\n    def __str__(self):\n        \"\"\"Human representation of a person plugin\"\"\"\n        return \"{model:s}: {id:d}\".format(\n            model=self._meta.verbose_name.title(), id=self.id\n        )\n", "path": "src/richie/apps/persons/models.py"}]}