prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  WYSIWYG for static pages
  Client-side WYSIWYG : 
  - http://sofish.github.io/pen/
  - https://github.com/mduvall/grande.js
  - http://imperavi.com/redactor/
  - https://github.com/tholman/zenpen
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `geotrek/flatpages/views.py`
  Content:
  ```
  1 from rest_framework import viewsets
  2 
  3 from geotrek.flatpages.serializers import FlatPageSerializer
  4 from geotrek.flatpages import models as flatpages_models
  5 
  6 
  7 class FlatPageViewSet(viewsets.ModelViewSet):
  8     """
  9     A viewset for viewing and editing flat pages instances.
  10     """
  11     serializer_class = FlatPageSerializer
  12     queryset = flatpages_models.FlatPage.objects.all()
  13
  ```
  
  Path: `geotrek/flatpages/admin.py`
  Content:
  ```
  1 from django.contrib import admin
  2 from django.conf import settings
  3 
  4 from modeltranslation.admin import TranslationAdmin
  5 
  6 from geotrek.flatpages import models as flatpages_models
  7 
  8 
  9 class FlatPagesAdmin(TranslationAdmin):
  10     list_display = ('title', 'published', 'publication_date', 'target')
  11     search_fields = ('title', 'content')
  12 
  13 
  14 if settings.FLATPAGES_ENABLED:
  15     admin.site.register(flatpages_models.FlatPage, FlatPagesAdmin)
  16
  ```
  --- 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/geotrek/flatpages/admin.py b/geotrek/flatpages/admin.py
  --- a/geotrek/flatpages/admin.py
  +++ b/geotrek/flatpages/admin.py
  @@ -2,6 +2,7 @@
   from django.conf import settings
   
   from modeltranslation.admin import TranslationAdmin
  +from tinymce.widgets import TinyMCE
   
   from geotrek.flatpages import models as flatpages_models
   
  @@ -10,6 +11,11 @@
       list_display = ('title', 'published', 'publication_date', 'target')
       search_fields = ('title', 'content')
   
  +    def formfield_for_dbfield(self, db_field, **kwargs):
  +        if db_field.name[:7] == 'content':
  +            return db_field.formfield(widget=TinyMCE)
  +        return super(FlatPagesAdmin, self).formfield_for_dbfield(db_field, **kwargs)
  +
   
   if settings.FLATPAGES_ENABLED:
       admin.site.register(flatpages_models.FlatPage, FlatPagesAdmin)
  diff --git a/geotrek/flatpages/views.py b/geotrek/flatpages/views.py
  --- a/geotrek/flatpages/views.py
  +++ b/geotrek/flatpages/views.py
  @@ -1,3 +1,4 @@
  +from rest_framework import permissions as rest_permissions
   from rest_framework import viewsets
   
   from geotrek.flatpages.serializers import FlatPageSerializer
  @@ -8,5 +9,9 @@
       """
       A viewset for viewing and editing flat pages instances.
       """
  +    model = flatpages_models.FlatPage
       serializer_class = FlatPageSerializer
  -    queryset = flatpages_models.FlatPage.objects.all()
  +    permission_classes = [rest_permissions.DjangoModelPermissionsOrAnonReadOnly]
  +
  +    def get_queryset(self):
  +        return flatpages_models.FlatPage.objects.filter(published=True)
  
verification_info: {"golden_diff": "diff --git a/geotrek/flatpages/admin.py b/geotrek/flatpages/admin.py\n--- a/geotrek/flatpages/admin.py\n+++ b/geotrek/flatpages/admin.py\n@@ -2,6 +2,7 @@\n from django.conf import settings\n \n from modeltranslation.admin import TranslationAdmin\n+from tinymce.widgets import TinyMCE\n \n from geotrek.flatpages import models as flatpages_models\n \n@@ -10,6 +11,11 @@\n     list_display = ('title', 'published', 'publication_date', 'target')\n     search_fields = ('title', 'content')\n \n+    def formfield_for_dbfield(self, db_field, **kwargs):\n+        if db_field.name[:7] == 'content':\n+            return db_field.formfield(widget=TinyMCE)\n+        return super(FlatPagesAdmin, self).formfield_for_dbfield(db_field, **kwargs)\n+\n \n if settings.FLATPAGES_ENABLED:\n     admin.site.register(flatpages_models.FlatPage, FlatPagesAdmin)\ndiff --git a/geotrek/flatpages/views.py b/geotrek/flatpages/views.py\n--- a/geotrek/flatpages/views.py\n+++ b/geotrek/flatpages/views.py\n@@ -1,3 +1,4 @@\n+from rest_framework import permissions as rest_permissions\n from rest_framework import viewsets\n \n from geotrek.flatpages.serializers import FlatPageSerializer\n@@ -8,5 +9,9 @@\n     \"\"\"\n     A viewset for viewing and editing flat pages instances.\n     \"\"\"\n+    model = flatpages_models.FlatPage\n     serializer_class = FlatPageSerializer\n-    queryset = flatpages_models.FlatPage.objects.all()\n+    permission_classes = [rest_permissions.DjangoModelPermissionsOrAnonReadOnly]\n+\n+    def get_queryset(self):\n+        return flatpages_models.FlatPage.objects.filter(published=True)\n", "issue": "WYSIWYG for static pages\nClient-side WYSIWYG : \n- http://sofish.github.io/pen/\n- https://github.com/mduvall/grande.js\n- http://imperavi.com/redactor/\n- https://github.com/tholman/zenpen\n\n", "before_files": [{"content": "from rest_framework import viewsets\n\nfrom geotrek.flatpages.serializers import FlatPageSerializer\nfrom geotrek.flatpages import models as flatpages_models\n\n\nclass FlatPageViewSet(viewsets.ModelViewSet):\n    \"\"\"\n    A viewset for viewing and editing flat pages instances.\n    \"\"\"\n    serializer_class = FlatPageSerializer\n    queryset = flatpages_models.FlatPage.objects.all()\n", "path": "geotrek/flatpages/views.py"}, {"content": "from django.contrib import admin\nfrom django.conf import settings\n\nfrom modeltranslation.admin import TranslationAdmin\n\nfrom geotrek.flatpages import models as flatpages_models\n\n\nclass FlatPagesAdmin(TranslationAdmin):\n    list_display = ('title', 'published', 'publication_date', 'target')\n    search_fields = ('title', 'content')\n\n\nif settings.FLATPAGES_ENABLED:\n    admin.site.register(flatpages_models.FlatPage, FlatPagesAdmin)\n", "path": "geotrek/flatpages/admin.py"}], "after_files": [{"content": "from rest_framework import permissions as rest_permissions\nfrom rest_framework import viewsets\n\nfrom geotrek.flatpages.serializers import FlatPageSerializer\nfrom geotrek.flatpages import models as flatpages_models\n\n\nclass FlatPageViewSet(viewsets.ModelViewSet):\n    \"\"\"\n    A viewset for viewing and editing flat pages instances.\n    \"\"\"\n    model = flatpages_models.FlatPage\n    serializer_class = FlatPageSerializer\n    permission_classes = [rest_permissions.DjangoModelPermissionsOrAnonReadOnly]\n\n    def get_queryset(self):\n        return flatpages_models.FlatPage.objects.filter(published=True)\n", "path": "geotrek/flatpages/views.py"}, {"content": "from django.contrib import admin\nfrom django.conf import settings\n\nfrom modeltranslation.admin import TranslationAdmin\nfrom tinymce.widgets import TinyMCE\n\nfrom geotrek.flatpages import models as flatpages_models\n\n\nclass FlatPagesAdmin(TranslationAdmin):\n    list_display = ('title', 'published', 'publication_date', 'target')\n    search_fields = ('title', 'content')\n\n    def formfield_for_dbfield(self, db_field, **kwargs):\n        if db_field.name[:7] == 'content':\n            return db_field.formfield(widget=TinyMCE)\n        return super(FlatPagesAdmin, self).formfield_for_dbfield(db_field, **kwargs)\n\n\nif settings.FLATPAGES_ENABLED:\n    admin.site.register(flatpages_models.FlatPage, FlatPagesAdmin)\n", "path": "geotrek/flatpages/admin.py"}]}