prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Make offline archive look more like event archive
  Same as #481. This is mainly about the filtering section.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `apps/api/v0/article.py`
  Content:
  ```
  1 #-*- coding: utf-8 -*-
  2 from copy import copy
  3 
  4 from django.conf import settings
  5 from django.template.defaultfilters import slugify
  6 from django.utils import timezone
  7 
  8 from filebrowser.base import FileObject
  9 from filebrowser.settings import VERSIONS
  10 from tastypie import fields
  11 from tastypie.resources import ModelResource
  12 
  13 from apps.api.v0.authentication import UserResource
  14 from apps.article.models import Article, ArticleTag, Tag
  15 
  16 
  17 
  18 
  19 class ArticleResource(ModelResource):
  20     author = fields.ToOneField(UserResource, 'created_by')
  21     
  22     def alter_list_data_to_serialize(self, request, data):
  23         # Renames list data 'object' to 'articles'.
  24         if isinstance(data, dict):
  25             data['articles'] = copy(data['objects'])
  26             del(data['objects'])
  27         return data
  28     
  29     # Making multiple images for the article
  30     def dehydrate(self, bundle):
  31         
  32         # Setting slug-field
  33         bundle.data['slug'] = slugify(bundle.data['heading'])
  34         
  35         # If image is set
  36         if bundle.data['image']:
  37             # Parse to FileObject used by Filebrowser
  38             temp_image = FileObject(bundle.data['image'])
  39             
  40             # Itterate the different versions (by key)
  41             for ver in VERSIONS.keys():
  42                 # Check if the key start with article_ (if it does, we want to crop to that size)
  43                 if ver.startswith('article_'):
  44                     # Adding the new image to the object
  45                     bundle.data['image_'+ver] = temp_image.version_generate(ver).url
  46             
  47             # Unset the image-field
  48             del(bundle.data['image'])
  49             
  50             # Returning washed object
  51         return bundle
  52     
  53     def get_object_list(self, request):
  54         # Getting the GET-params
  55         if 'tag' in request.GET:
  56             request_tag = request.GET['tag']
  57         else:
  58             request_tag = None
  59         
  60         if 'year' in request.GET:
  61             request_year = request.GET['year']
  62         else:
  63             request_year = None
  64         
  65         if 'month' in request.GET:
  66             request_month = request.GET['month']
  67         else:
  68             request_month = None
  69         
  70         # Check filtering here
  71         if (request_year is not None):
  72             if (request_month is not None):
  73                 # Filtering on both year and month
  74                 queryset = Article.objects.filter(published_date__year=request_year, published_date__month=request_month, published_date__lte=timezone.now()).order_by('-published_date')
  75             else:
  76                 # Filtering on only year
  77                 queryset = Article.objects.filter(published_date__year=request_year, published_date__lte=timezone.now()).order_by('-published_date')
  78         else:
  79             # Not filtering on year, check if filtering on slug (tag) or return default query
  80             if (request_tag is not None):
  81                 # Filtering on slug
  82                 slug_query = Tag.objects.filter(slug = request_tag)
  83                 slug_connect = ArticleTag.objects.filter(tag = slug_query).values('article_id')
  84                 queryset = Article.objects.filter(id__in = slug_connect, published_date__lte=timezone.now()).order_by('-published_date')
  85             else:
  86                 # No filtering at all, return default query
  87                 queryset = Article.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')
  88         return queryset
  89     
  90     class Meta:     
  91         API_LIMIT_PER_PAGE = 9
  92         queryset = Article.objects.filter(published_date__lte=timezone.now())
  93         resource_name = 'article/all'
  94         ordering = ['-published_date']
  95         include_absolute_url = True
  96         filtering = {
  97             'featured' : ('exact',),
  98             'published_date' : ('gte',),
  99         }
  100 
  101 class ArticleLatestResource(ModelResource):
  102     author = fields.ToOneField(UserResource, 'created_by')
  103     
  104     class Meta:
  105         queryset = Article.objects.filter(published_date__lte=timezone.now())
  106         
  107         resource_name = 'article/latest'
  108         filtering = {
  109             'featured': ('exact',)
  110         }
  111         ordering = ['-published_date']
  112         max_limit = 25
  113     def alter_list_data_to_serialize(self, request, data):
  114         # Renames list data 'object' to 'articles'.
  115         if isinstance(data, dict): 
  116             data['articles'] = copy(data['objects'])
  117             del(data['objects'])
  118         return data
  119     def dehydrate(self, bundle):
  120         bundle.data['slug'] = slugify(bundle.data['heading'])
  121         return bundle
  122
  ```
  --- 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/apps/api/v0/article.py b/apps/api/v0/article.py
  --- a/apps/api/v0/article.py
  +++ b/apps/api/v0/article.py
  @@ -17,7 +17,7 @@
   
   
   class ArticleResource(ModelResource):
  -    author = fields.ToOneField(UserResource, 'created_by')
  +    author = fields.ToOneField(UserResource, 'created_by', full=True)
       
       def alter_list_data_to_serialize(self, request, data):
           # Renames list data 'object' to 'articles'.
  
verification_info: {"golden_diff": "diff --git a/apps/api/v0/article.py b/apps/api/v0/article.py\n--- a/apps/api/v0/article.py\n+++ b/apps/api/v0/article.py\n@@ -17,7 +17,7 @@\n \n \n class ArticleResource(ModelResource):\n-    author = fields.ToOneField(UserResource, 'created_by')\n+    author = fields.ToOneField(UserResource, 'created_by', full=True)\n     \n     def alter_list_data_to_serialize(self, request, data):\n         # Renames list data 'object' to 'articles'.\n", "issue": "Make offline archive look more like event archive\nSame as #481. This is mainly about the filtering section.\n\n", "before_files": [{"content": "#-*- coding: utf-8 -*-\nfrom copy import copy\n\nfrom django.conf import settings\nfrom django.template.defaultfilters import slugify\nfrom django.utils import timezone\n\nfrom filebrowser.base import FileObject\nfrom filebrowser.settings import VERSIONS\nfrom tastypie import fields\nfrom tastypie.resources import ModelResource\n\nfrom apps.api.v0.authentication import UserResource\nfrom apps.article.models import Article, ArticleTag, Tag\n\n\n\n\nclass ArticleResource(ModelResource):\n    author = fields.ToOneField(UserResource, 'created_by')\n    \n    def alter_list_data_to_serialize(self, request, data):\n        # Renames list data 'object' to 'articles'.\n        if isinstance(data, dict):\n            data['articles'] = copy(data['objects'])\n            del(data['objects'])\n        return data\n    \n    # Making multiple images for the article\n    def dehydrate(self, bundle):\n        \n        # Setting slug-field\n        bundle.data['slug'] = slugify(bundle.data['heading'])\n        \n        # If image is set\n        if bundle.data['image']:\n            # Parse to FileObject used by Filebrowser\n            temp_image = FileObject(bundle.data['image'])\n            \n            # Itterate the different versions (by key)\n            for ver in VERSIONS.keys():\n                # Check if the key start with article_ (if it does, we want to crop to that size)\n                if ver.startswith('article_'):\n                    # Adding the new image to the object\n                    bundle.data['image_'+ver] = temp_image.version_generate(ver).url\n            \n            # Unset the image-field\n            del(bundle.data['image'])\n            \n            # Returning washed object\n        return bundle\n    \n    def get_object_list(self, request):\n        # Getting the GET-params\n        if 'tag' in request.GET:\n            request_tag = request.GET['tag']\n        else:\n            request_tag = None\n        \n        if 'year' in request.GET:\n            request_year = request.GET['year']\n        else:\n            request_year = None\n        \n        if 'month' in request.GET:\n            request_month = request.GET['month']\n        else:\n            request_month = None\n        \n        # Check filtering here\n        if (request_year is not None):\n            if (request_month is not None):\n                # Filtering on both year and month\n                queryset = Article.objects.filter(published_date__year=request_year, published_date__month=request_month, published_date__lte=timezone.now()).order_by('-published_date')\n            else:\n                # Filtering on only year\n                queryset = Article.objects.filter(published_date__year=request_year, published_date__lte=timezone.now()).order_by('-published_date')\n        else:\n            # Not filtering on year, check if filtering on slug (tag) or return default query\n            if (request_tag is not None):\n                # Filtering on slug\n                slug_query = Tag.objects.filter(slug = request_tag)\n                slug_connect = ArticleTag.objects.filter(tag = slug_query).values('article_id')\n                queryset = Article.objects.filter(id__in = slug_connect, published_date__lte=timezone.now()).order_by('-published_date')\n            else:\n                # No filtering at all, return default query\n                queryset = Article.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')\n        return queryset\n    \n    class Meta:     \n        API_LIMIT_PER_PAGE = 9\n        queryset = Article.objects.filter(published_date__lte=timezone.now())\n        resource_name = 'article/all'\n        ordering = ['-published_date']\n        include_absolute_url = True\n        filtering = {\n            'featured' : ('exact',),\n            'published_date' : ('gte',),\n        }\n\nclass ArticleLatestResource(ModelResource):\n    author = fields.ToOneField(UserResource, 'created_by')\n    \n    class Meta:\n        queryset = Article.objects.filter(published_date__lte=timezone.now())\n        \n        resource_name = 'article/latest'\n        filtering = {\n            'featured': ('exact',)\n        }\n        ordering = ['-published_date']\n        max_limit = 25\n    def alter_list_data_to_serialize(self, request, data):\n        # Renames list data 'object' to 'articles'.\n        if isinstance(data, dict): \n            data['articles'] = copy(data['objects'])\n            del(data['objects'])\n        return data\n    def dehydrate(self, bundle):\n        bundle.data['slug'] = slugify(bundle.data['heading'])\n        return bundle\n", "path": "apps/api/v0/article.py"}], "after_files": [{"content": "#-*- coding: utf-8 -*-\nfrom copy import copy\n\nfrom django.conf import settings\nfrom django.template.defaultfilters import slugify\nfrom django.utils import timezone\n\nfrom filebrowser.base import FileObject\nfrom filebrowser.settings import VERSIONS\nfrom tastypie import fields\nfrom tastypie.resources import ModelResource\n\nfrom apps.api.v0.authentication import UserResource\nfrom apps.article.models import Article, ArticleTag, Tag\n\n\n\n\nclass ArticleResource(ModelResource):\n    author = fields.ToOneField(UserResource, 'created_by', full=True)\n    \n    def alter_list_data_to_serialize(self, request, data):\n        # Renames list data 'object' to 'articles'.\n        if isinstance(data, dict):\n            data['articles'] = copy(data['objects'])\n            del(data['objects'])\n        return data\n    \n    # Making multiple images for the article\n    def dehydrate(self, bundle):\n        \n        # Setting slug-field\n        bundle.data['slug'] = slugify(bundle.data['heading'])\n        \n        # If image is set\n        if bundle.data['image']:\n            # Parse to FileObject used by Filebrowser\n            temp_image = FileObject(bundle.data['image'])\n            \n            # Itterate the different versions (by key)\n            for ver in VERSIONS.keys():\n                # Check if the key start with article_ (if it does, we want to crop to that size)\n                if ver.startswith('article_'):\n                    # Adding the new image to the object\n                    bundle.data['image_'+ver] = temp_image.version_generate(ver).url\n            \n            # Unset the image-field\n            del(bundle.data['image'])\n            \n            # Returning washed object\n        return bundle\n    \n    def get_object_list(self, request):\n        # Getting the GET-params\n        if 'tag' in request.GET:\n            request_tag = request.GET['tag']\n        else:\n            request_tag = None\n        \n        if 'year' in request.GET:\n            request_year = request.GET['year']\n        else:\n            request_year = None\n        \n        if 'month' in request.GET:\n            request_month = request.GET['month']\n        else:\n            request_month = None\n        \n        # Check filtering here\n        if (request_year is not None):\n            if (request_month is not None):\n                # Filtering on both year and month\n                queryset = Article.objects.filter(published_date__year=request_year, published_date__month=request_month, published_date__lte=timezone.now()).order_by('-published_date')\n            else:\n                # Filtering on only year\n                queryset = Article.objects.filter(published_date__year=request_year, published_date__lte=timezone.now()).order_by('-published_date')\n        else:\n            # Not filtering on year, check if filtering on slug (tag) or return default query\n            if (request_tag is not None):\n                # Filtering on slug\n                slug_query = Tag.objects.filter(slug = request_tag)\n                slug_connect = ArticleTag.objects.filter(tag = slug_query).values('article_id')\n                queryset = Article.objects.filter(id__in = slug_connect, published_date__lte=timezone.now()).order_by('-published_date')\n            else:\n                # No filtering at all, return default query\n                queryset = Article.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')\n        return queryset\n    \n    class Meta:     \n        API_LIMIT_PER_PAGE = 9\n        queryset = Article.objects.filter(published_date__lte=timezone.now())\n        resource_name = 'article/all'\n        ordering = ['-published_date']\n        include_absolute_url = True\n        filtering = {\n            'featured' : ('exact',),\n            'published_date' : ('gte',),\n        }\n\nclass ArticleLatestResource(ModelResource):\n    author = fields.ToOneField(UserResource, 'created_by')\n    \n    class Meta:\n        queryset = Article.objects.filter(published_date__lte=timezone.now())\n        \n        resource_name = 'article/latest'\n        filtering = {\n            'featured': ('exact',)\n        }\n        ordering = ['-published_date']\n        max_limit = 25\n    def alter_list_data_to_serialize(self, request, data):\n        # Renames list data 'object' to 'articles'.\n        if isinstance(data, dict): \n            data['articles'] = copy(data['objects'])\n            del(data['objects'])\n        return data\n    def dehydrate(self, bundle):\n        bundle.data['slug'] = slugify(bundle.data['heading'])\n        return bundle\n", "path": "apps/api/v0/article.py"}]}