We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
status bar AND project finished both shown on pop up
![bildschirmfoto 2019-02-04 um 14 11 24](https://user-images.githubusercontent.com/35491681/52210297-ebe6a200-2886-11e9-8f4e-4360398140b8.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `meinberlin/apps/plans/serializers.py`
Content:
```
1 from django.utils.translation import ugettext as _
2 from easy_thumbnails.files import get_thumbnailer
3 from rest_framework import serializers
4 
5 from adhocracy4.projects.models import Project
6 from meinberlin.apps.projects import get_project_type
7 
8 from .models import Plan
9 
10 
11 class CommonFields:
12 
13     def get_district(self, instance):
14         city_wide = _('City wide')
15         district_name = str(city_wide)
16         if instance.administrative_district:
17             district_name = instance.administrative_district.name
18         return district_name
19 
20     def get_point(self, instance):
21         point = instance.point
22         if not point:
23             point = ''
24         return point
25 
26     def get_organisation(self, instance):
27         return instance.organisation.name
28 
29 
30 class ProjectSerializer(serializers.ModelSerializer, CommonFields):
31     type = serializers.SerializerMethodField()
32     subtype = serializers.SerializerMethodField()
33     title = serializers.SerializerMethodField()
34     url = serializers.SerializerMethodField()
35     point = serializers.SerializerMethodField()
36     point_label = serializers.SerializerMethodField()
37     cost = serializers.SerializerMethodField()
38     district = serializers.SerializerMethodField()
39     status = serializers.SerializerMethodField()
40     organisation = serializers.SerializerMethodField()
41     participation = serializers.SerializerMethodField()
42     participation_display = serializers.SerializerMethodField()
43     participation_active = serializers.SerializerMethodField()
44     participation_string = serializers.SerializerMethodField()
45     future_phase = serializers.SerializerMethodField()
46     active_phase = serializers.SerializerMethodField()
47     past_phase = serializers.SerializerMethodField()
48     tile_image = serializers.SerializerMethodField()
49     plan_url = serializers.SerializerMethodField()
50     plan_title = serializers.SerializerMethodField()
51     published_projects_count = serializers.SerializerMethodField()
52     created_or_modified = serializers.SerializerMethodField()
53 
54     class Meta:
55         model = Project
56         fields = ['type', 'subtype', 'title', 'url',
57                   'organisation', 'tile_image',
58                   'tile_image_copyright',
59                   'point', 'point_label', 'cost',
60                   'district', 'topics',
61                   'status',
62                   'participation_string',
63                   'participation_active',
64                   'participation', 'participation_display', 'description',
65                   'future_phase', 'active_phase',
66                   'past_phase', 'plan_url', 'plan_title',
67                   'published_projects_count', 'created_or_modified']
68 
69     def _get_participation_status_project(self, instance):
70         project_phases = instance.phases
71 
72         if project_phases.active_phases():
73             return _('running'), True
74 
75         if project_phases.future_phases():
76             try:
77                 return (_('starts at {}').format
78                         (project_phases.future_phases().first().
79                          start_date.date().strftime('%d.%m.%Y')),
80                         True)
81             except AttributeError as e:
82                 print(e)
83                 return (_('starts in the future'),
84                         True)
85         else:
86             return _('done'), False
87 
88     def get_type(self, instance):
89         return 'project'
90 
91     def get_subtype(self, instance):
92         subtype = get_project_type(instance)
93         if subtype in ('external', 'bplan'):
94             return 'external'
95         return subtype
96 
97     def get_title(self, instance):
98         return instance.name
99 
100     def get_url(self, instance):
101         if get_project_type(instance) in ('external', 'bplan'):
102             return instance.externalproject.url
103         return instance.get_absolute_url()
104 
105     def get_tile_image(self, instance):
106         image_url = ''
107         if instance.tile_image:
108             image = get_thumbnailer(instance.tile_image)['project_tile']
109             image_url = image.url
110         return image_url
111 
112     def get_status(self, instance):
113         project_phases = instance.phases
114         if project_phases.active_phases() or project_phases.future_phases():
115             return 0
116         return 1
117 
118     def get_participation(self, instance):
119         return 0
120 
121     def get_participation_display(self, instance):
122         return _('Yes')
123 
124     def get_future_phase(self, instance):
125         if (instance.future_phases and
126                 instance.future_phases.first().start_date):
127             return str(
128                 instance.future_phases.first().start_date.date())
129         return False
130 
131     def get_active_phase(self, instance):
132         project_phases = instance.phases
133         if project_phases.active_phases():
134             progress = instance.active_phase_progress
135             time_left = instance.time_left
136             end_date = str(project_phases.active_phases().last().end_date)
137             return [progress, time_left, end_date]
138         return False
139 
140     def get_past_phase(self, instance):
141         project_phases = instance.phases
142         if (project_phases.past_phases() and
143                 project_phases.past_phases().first().end_date):
144             return str(
145                 project_phases.past_phases().first().end_date.date())
146         return False
147 
148     def get_participation_string(self, instance):
149         participation_string, participation_active = \
150             self._get_participation_status_project(instance)
151         return str(participation_string)
152 
153     def get_participation_active(self, instance):
154         participation_string, participation_active = \
155             self._get_participation_status_project(instance)
156         return participation_active
157 
158     def get_plan_url(self, instance):
159         if instance.plans.exists():
160             return instance.plans.first().get_absolute_url()
161         return None
162 
163     def get_plan_title(self, instance):
164         if instance.plans.exists():
165             return instance.plans.first().title
166         return None
167 
168     def get_published_projects_count(self, instance):
169         if hasattr(instance, 'projectcontainer') and instance.projectcontainer:
170             return instance.projectcontainer.active_project_count
171 
172     def get_point_label(self, instance):
173         return ''
174 
175     def get_cost(self, instance):
176         return ''
177 
178     def get_created_or_modified(self, instance):
179         if instance.modified:
180             return str(instance.modified)
181         return str(instance.created)
182 
183 
184 class PlanSerializer(serializers.ModelSerializer, CommonFields):
185     type = serializers.SerializerMethodField()
186     subtype = serializers.SerializerMethodField()
187     url = serializers.SerializerMethodField()
188     district = serializers.SerializerMethodField()
189     point = serializers.SerializerMethodField()
190     participation_active = serializers.SerializerMethodField()
191     participation_string = serializers.SerializerMethodField()
192     published_projects_count = serializers.SerializerMethodField()
193     organisation = serializers.SerializerMethodField()
194     created_or_modified = serializers.SerializerMethodField()
195 
196     class Meta:
197         model = Plan
198         fields = ['type', 'subtype', 'title', 'url',
199                   'organisation', 'point',
200                   'point_label', 'cost',
201                   'district', 'topics', 'status',
202                   'participation',
203                   'participation_string',
204                   'participation_active',
205                   'published_projects_count', 'created_or_modified']
206 
207     def get_subtype(self, instance):
208         return 'plan'
209 
210     def _get_participation_status_plan(self, item):
211         projects = item.published_projects
212         if not projects:
213             return item.get_participation_display(), False
214         else:
215             status_string = item.participation_string
216             if status_string:
217                 return status_string, True
218             else:
219                 return item.get_participation_display(), False
220 
221     def get_type(self, instance):
222         return 'plan'
223 
224     def get_url(self, instance):
225         return instance.get_absolute_url()
226 
227     def get_published_projects_count(self, instance):
228         return instance.published_projects.count()
229 
230     def get_participation_string(self, instance):
231         participation_string, participation_active = \
232             self._get_participation_status_plan(instance)
233         return str(participation_string)
234 
235     def get_participation_active(self, instance):
236         participation_string, participation_active = \
237             self._get_participation_status_plan(instance)
238         return participation_active
239 
240     def get_created_or_modified(self, instance):
241         if instance.modified:
242             return str(instance.modified)
243         return str(instance.created)
244
```
--- 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/meinberlin/apps/plans/serializers.py b/meinberlin/apps/plans/serializers.py
--- a/meinberlin/apps/plans/serializers.py
+++ b/meinberlin/apps/plans/serializers.py
@@ -26,6 +26,11 @@
     def get_organisation(self, instance):
         return instance.organisation.name
 
+    def get_created_or_modified(self, instance):
+        if instance.modified:
+            return str(instance.modified)
+        return str(instance.created)
+
 
 class ProjectSerializer(serializers.ModelSerializer, CommonFields):
     type = serializers.SerializerMethodField()
@@ -130,7 +135,7 @@
 
     def get_active_phase(self, instance):
         project_phases = instance.phases
-        if project_phases.active_phases():
+        if project_phases.active_phases() and instance.active_phase_progress:
             progress = instance.active_phase_progress
             time_left = instance.time_left
             end_date = str(project_phases.active_phases().last().end_date)
@@ -175,11 +180,6 @@
     def get_cost(self, instance):
         return ''
 
-    def get_created_or_modified(self, instance):
-        if instance.modified:
-            return str(instance.modified)
-        return str(instance.created)
-
 
 class PlanSerializer(serializers.ModelSerializer, CommonFields):
     type = serializers.SerializerMethodField()
@@ -236,8 +236,3 @@
         participation_string, participation_active = \
             self._get_participation_status_plan(instance)
         return participation_active
-
-    def get_created_or_modified(self, instance):
-        if instance.modified:
-            return str(instance.modified)
-        return str(instance.created)

{"golden_diff": "diff --git a/meinberlin/apps/plans/serializers.py b/meinberlin/apps/plans/serializers.py\n--- a/meinberlin/apps/plans/serializers.py\n+++ b/meinberlin/apps/plans/serializers.py\n@@ -26,6 +26,11 @@\n     def get_organisation(self, instance):\n         return instance.organisation.name\n \n+    def get_created_or_modified(self, instance):\n+        if instance.modified:\n+            return str(instance.modified)\n+        return str(instance.created)\n+\n \n class ProjectSerializer(serializers.ModelSerializer, CommonFields):\n     type = serializers.SerializerMethodField()\n@@ -130,7 +135,7 @@\n \n     def get_active_phase(self, instance):\n         project_phases = instance.phases\n-        if project_phases.active_phases():\n+        if project_phases.active_phases() and instance.active_phase_progress:\n             progress = instance.active_phase_progress\n             time_left = instance.time_left\n             end_date = str(project_phases.active_phases().last().end_date)\n@@ -175,11 +180,6 @@\n     def get_cost(self, instance):\n         return ''\n \n-    def get_created_or_modified(self, instance):\n-        if instance.modified:\n-            return str(instance.modified)\n-        return str(instance.created)\n-\n \n class PlanSerializer(serializers.ModelSerializer, CommonFields):\n     type = serializers.SerializerMethodField()\n@@ -236,8 +236,3 @@\n         participation_string, participation_active = \\\n             self._get_participation_status_plan(instance)\n         return participation_active\n-\n-    def get_created_or_modified(self, instance):\n-        if instance.modified:\n-            return str(instance.modified)\n-        return str(instance.created)\n", "issue": "status bar AND project finished both shown on pop up\n![bildschirmfoto 2019-02-04 um 14 11 24](https://user-images.githubusercontent.com/35491681/52210297-ebe6a200-2886-11e9-8f4e-4360398140b8.png)\r\n\n", "before_files": [{"content": "from django.utils.translation import ugettext as _\nfrom easy_thumbnails.files import get_thumbnailer\nfrom rest_framework import serializers\n\nfrom adhocracy4.projects.models import Project\nfrom meinberlin.apps.projects import get_project_type\n\nfrom .models import Plan\n\n\nclass CommonFields:\n\n    def get_district(self, instance):\n        city_wide = _('City wide')\n        district_name = str(city_wide)\n        if instance.administrative_district:\n            district_name = instance.administrative_district.name\n        return district_name\n\n    def get_point(self, instance):\n        point = instance.point\n        if not point:\n            point = ''\n        return point\n\n    def get_organisation(self, instance):\n        return instance.organisation.name\n\n\nclass ProjectSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    title = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    point_label = serializers.SerializerMethodField()\n    cost = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    status = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    participation = serializers.SerializerMethodField()\n    participation_display = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    future_phase = serializers.SerializerMethodField()\n    active_phase = serializers.SerializerMethodField()\n    past_phase = serializers.SerializerMethodField()\n    tile_image = serializers.SerializerMethodField()\n    plan_url = serializers.SerializerMethodField()\n    plan_title = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n    created_or_modified = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Project\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'tile_image',\n                  'tile_image_copyright',\n                  'point', 'point_label', 'cost',\n                  'district', 'topics',\n                  'status',\n                  'participation_string',\n                  'participation_active',\n                  'participation', 'participation_display', 'description',\n                  'future_phase', 'active_phase',\n                  'past_phase', 'plan_url', 'plan_title',\n                  'published_projects_count', 'created_or_modified']\n\n    def _get_participation_status_project(self, instance):\n        project_phases = instance.phases\n\n        if project_phases.active_phases():\n            return _('running'), True\n\n        if project_phases.future_phases():\n            try:\n                return (_('starts at {}').format\n                        (project_phases.future_phases().first().\n                         start_date.date().strftime('%d.%m.%Y')),\n                        True)\n            except AttributeError as e:\n                print(e)\n                return (_('starts in the future'),\n                        True)\n        else:\n            return _('done'), False\n\n    def get_type(self, instance):\n        return 'project'\n\n    def get_subtype(self, instance):\n        subtype = get_project_type(instance)\n        if subtype in ('external', 'bplan'):\n            return 'external'\n        return subtype\n\n    def get_title(self, instance):\n        return instance.name\n\n    def get_url(self, instance):\n        if get_project_type(instance) in ('external', 'bplan'):\n            return instance.externalproject.url\n        return instance.get_absolute_url()\n\n    def get_tile_image(self, instance):\n        image_url = ''\n        if instance.tile_image:\n            image = get_thumbnailer(instance.tile_image)['project_tile']\n            image_url = image.url\n        return image_url\n\n    def get_status(self, instance):\n        project_phases = instance.phases\n        if project_phases.active_phases() or project_phases.future_phases():\n            return 0\n        return 1\n\n    def get_participation(self, instance):\n        return 0\n\n    def get_participation_display(self, instance):\n        return _('Yes')\n\n    def get_future_phase(self, instance):\n        if (instance.future_phases and\n                instance.future_phases.first().start_date):\n            return str(\n                instance.future_phases.first().start_date.date())\n        return False\n\n    def get_active_phase(self, instance):\n        project_phases = instance.phases\n        if project_phases.active_phases():\n            progress = instance.active_phase_progress\n            time_left = instance.time_left\n            end_date = str(project_phases.active_phases().last().end_date)\n            return [progress, time_left, end_date]\n        return False\n\n    def get_past_phase(self, instance):\n        project_phases = instance.phases\n        if (project_phases.past_phases() and\n                project_phases.past_phases().first().end_date):\n            return str(\n                project_phases.past_phases().first().end_date.date())\n        return False\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return participation_active\n\n    def get_plan_url(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().get_absolute_url()\n        return None\n\n    def get_plan_title(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().title\n        return None\n\n    def get_published_projects_count(self, instance):\n        if hasattr(instance, 'projectcontainer') and instance.projectcontainer:\n            return instance.projectcontainer.active_project_count\n\n    def get_point_label(self, instance):\n        return ''\n\n    def get_cost(self, instance):\n        return ''\n\n    def get_created_or_modified(self, instance):\n        if instance.modified:\n            return str(instance.modified)\n        return str(instance.created)\n\n\nclass PlanSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    created_or_modified = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Plan\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'point',\n                  'point_label', 'cost',\n                  'district', 'topics', 'status',\n                  'participation',\n                  'participation_string',\n                  'participation_active',\n                  'published_projects_count', 'created_or_modified']\n\n    def get_subtype(self, instance):\n        return 'plan'\n\n    def _get_participation_status_plan(self, item):\n        projects = item.published_projects\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            status_string = item.participation_string\n            if status_string:\n                return status_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_type(self, instance):\n        return 'plan'\n\n    def get_url(self, instance):\n        return instance.get_absolute_url()\n\n    def get_published_projects_count(self, instance):\n        return instance.published_projects.count()\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return participation_active\n\n    def get_created_or_modified(self, instance):\n        if instance.modified:\n            return str(instance.modified)\n        return str(instance.created)\n", "path": "meinberlin/apps/plans/serializers.py"}], "after_files": [{"content": "from django.utils.translation import ugettext as _\nfrom easy_thumbnails.files import get_thumbnailer\nfrom rest_framework import serializers\n\nfrom adhocracy4.projects.models import Project\nfrom meinberlin.apps.projects import get_project_type\n\nfrom .models import Plan\n\n\nclass CommonFields:\n\n    def get_district(self, instance):\n        city_wide = _('City wide')\n        district_name = str(city_wide)\n        if instance.administrative_district:\n            district_name = instance.administrative_district.name\n        return district_name\n\n    def get_point(self, instance):\n        point = instance.point\n        if not point:\n            point = ''\n        return point\n\n    def get_organisation(self, instance):\n        return instance.organisation.name\n\n    def get_created_or_modified(self, instance):\n        if instance.modified:\n            return str(instance.modified)\n        return str(instance.created)\n\n\nclass ProjectSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    title = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    point_label = serializers.SerializerMethodField()\n    cost = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    status = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    participation = serializers.SerializerMethodField()\n    participation_display = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    future_phase = serializers.SerializerMethodField()\n    active_phase = serializers.SerializerMethodField()\n    past_phase = serializers.SerializerMethodField()\n    tile_image = serializers.SerializerMethodField()\n    plan_url = serializers.SerializerMethodField()\n    plan_title = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n    created_or_modified = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Project\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'tile_image',\n                  'tile_image_copyright',\n                  'point', 'point_label', 'cost',\n                  'district', 'topics',\n                  'status',\n                  'participation_string',\n                  'participation_active',\n                  'participation', 'participation_display', 'description',\n                  'future_phase', 'active_phase',\n                  'past_phase', 'plan_url', 'plan_title',\n                  'published_projects_count', 'created_or_modified']\n\n    def _get_participation_status_project(self, instance):\n        project_phases = instance.phases\n\n        if project_phases.active_phases():\n            return _('running'), True\n\n        if project_phases.future_phases():\n            try:\n                return (_('starts at {}').format\n                        (project_phases.future_phases().first().\n                         start_date.date().strftime('%d.%m.%Y')),\n                        True)\n            except AttributeError as e:\n                print(e)\n                return (_('starts in the future'),\n                        True)\n        else:\n            return _('done'), False\n\n    def get_type(self, instance):\n        return 'project'\n\n    def get_subtype(self, instance):\n        subtype = get_project_type(instance)\n        if subtype in ('external', 'bplan'):\n            return 'external'\n        return subtype\n\n    def get_title(self, instance):\n        return instance.name\n\n    def get_url(self, instance):\n        if get_project_type(instance) in ('external', 'bplan'):\n            return instance.externalproject.url\n        return instance.get_absolute_url()\n\n    def get_tile_image(self, instance):\n        image_url = ''\n        if instance.tile_image:\n            image = get_thumbnailer(instance.tile_image)['project_tile']\n            image_url = image.url\n        return image_url\n\n    def get_status(self, instance):\n        project_phases = instance.phases\n        if project_phases.active_phases() or project_phases.future_phases():\n            return 0\n        return 1\n\n    def get_participation(self, instance):\n        return 0\n\n    def get_participation_display(self, instance):\n        return _('Yes')\n\n    def get_future_phase(self, instance):\n        if (instance.future_phases and\n                instance.future_phases.first().start_date):\n            return str(\n                instance.future_phases.first().start_date.date())\n        return False\n\n    def get_active_phase(self, instance):\n        project_phases = instance.phases\n        if project_phases.active_phases() and instance.active_phase_progress:\n            progress = instance.active_phase_progress\n            time_left = instance.time_left\n            end_date = str(project_phases.active_phases().last().end_date)\n            return [progress, time_left, end_date]\n        return False\n\n    def get_past_phase(self, instance):\n        project_phases = instance.phases\n        if (project_phases.past_phases() and\n                project_phases.past_phases().first().end_date):\n            return str(\n                project_phases.past_phases().first().end_date.date())\n        return False\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_project(instance)\n        return participation_active\n\n    def get_plan_url(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().get_absolute_url()\n        return None\n\n    def get_plan_title(self, instance):\n        if instance.plans.exists():\n            return instance.plans.first().title\n        return None\n\n    def get_published_projects_count(self, instance):\n        if hasattr(instance, 'projectcontainer') and instance.projectcontainer:\n            return instance.projectcontainer.active_project_count\n\n    def get_point_label(self, instance):\n        return ''\n\n    def get_cost(self, instance):\n        return ''\n\n\nclass PlanSerializer(serializers.ModelSerializer, CommonFields):\n    type = serializers.SerializerMethodField()\n    subtype = serializers.SerializerMethodField()\n    url = serializers.SerializerMethodField()\n    district = serializers.SerializerMethodField()\n    point = serializers.SerializerMethodField()\n    participation_active = serializers.SerializerMethodField()\n    participation_string = serializers.SerializerMethodField()\n    published_projects_count = serializers.SerializerMethodField()\n    organisation = serializers.SerializerMethodField()\n    created_or_modified = serializers.SerializerMethodField()\n\n    class Meta:\n        model = Plan\n        fields = ['type', 'subtype', 'title', 'url',\n                  'organisation', 'point',\n                  'point_label', 'cost',\n                  'district', 'topics', 'status',\n                  'participation',\n                  'participation_string',\n                  'participation_active',\n                  'published_projects_count', 'created_or_modified']\n\n    def get_subtype(self, instance):\n        return 'plan'\n\n    def _get_participation_status_plan(self, item):\n        projects = item.published_projects\n        if not projects:\n            return item.get_participation_display(), False\n        else:\n            status_string = item.participation_string\n            if status_string:\n                return status_string, True\n            else:\n                return item.get_participation_display(), False\n\n    def get_type(self, instance):\n        return 'plan'\n\n    def get_url(self, instance):\n        return instance.get_absolute_url()\n\n    def get_published_projects_count(self, instance):\n        return instance.published_projects.count()\n\n    def get_participation_string(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return str(participation_string)\n\n    def get_participation_active(self, instance):\n        participation_string, participation_active = \\\n            self._get_participation_status_plan(instance)\n        return participation_active\n", "path": "meinberlin/apps/plans/serializers.py"}]}