prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Django User admin not working related to stripe_customer_id
  **Summary**
  <img width="1450" alt="Screen Shot 2020-05-20 at 1 01 52 PM" src="https://user-images.githubusercontent.com/26739/82475221-28e5a080-9a9a-11ea-948f-be97bf2c15d6.png">
  
  There *exists* a user with that username. 
  The user is there. I can manually type in the URL http://localhost.org:8000/admin/users/user/1311/change/ and it works. 
  
  It's related to `IsStripeCustomer` in `kuma/users/admin.py`.
  
  **Steps To Reproduce (STR)**
  
  1. Have a user with and without a `stripe_customer_id`
  2. Go to http://localhost.org:8000/admin/users/user/
  3. Is the user appearing?
  
  
  **Actual behavior**
  _What actually happened?_
  
  
  **Expected behavior**
  _What did you expect to happen?_
  
  
  **Additional context**
  Pretty sure it's the `IsStripeCustomer` thing that's filtering on the empty string even if you didn't filter on it. 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `kuma/users/admin.py`
  Content:
  ```
  1 from django.contrib import admin
  2 from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
  3 from django.utils.html import format_html
  4 
  5 from kuma.core.urlresolvers import reverse
  6 from kuma.core.utils import urlparams
  7 
  8 from .models import User, UserBan, UserSubscription
  9 
  10 
  11 @admin.register(UserBan)
  12 class UserBanAdmin(admin.ModelAdmin):
  13     fields = ("user", "by", "reason", "is_active")
  14     list_display = ("user", "by", "reason", "is_active")
  15     list_editable = ("is_active",)
  16     list_filter = ("is_active",)
  17     raw_id_fields = ("user", "by")
  18     search_fields = ("user__username", "reason", "by__username")
  19 
  20 
  21 class IsStripeCustomer(admin.SimpleListFilter):
  22     title = "is Stripe customer"
  23     parameter_name = "is_stripe_customer"
  24 
  25     def lookups(self, request, model_admin):
  26         return (
  27             (True, "Yes"),
  28             (False, "No"),
  29         )
  30 
  31     def queryset(self, request, queryset):
  32         if self.value():
  33             return queryset.exclude(stripe_customer_id="")
  34         else:
  35             return queryset.filter(stripe_customer_id="")
  36 
  37 
  38 @admin.register(User)
  39 class UserAdmin(BaseUserAdmin):
  40     """
  41     Extends the admin view of users to show date_joined field
  42     add a filter on the field too
  43     """
  44 
  45     fieldsets = BaseUserAdmin.fieldsets + (
  46         ("Subscription", {"fields": ("stripe_customer_id", "subscriber_number")}),
  47     )
  48     readonly_fields = BaseUserAdmin.readonly_fields + (
  49         "stripe_customer_id",
  50         "subscriber_number",
  51     )
  52 
  53     list_display = (
  54         "username",
  55         "fullname",
  56         "email",
  57         "revisions",
  58         "date_joined",
  59         "is_staff",
  60         "is_active",
  61     )
  62     list_filter = (
  63         "is_staff",
  64         "is_superuser",
  65         "is_active",
  66         "date_joined",
  67         "groups",
  68         IsStripeCustomer,
  69     )
  70     ordering = ("-date_joined",)
  71     search_fields = (
  72         "username",
  73         "title",
  74         "fullname",
  75         "organization",
  76         "location",
  77         "email",
  78     )
  79 
  80     def revisions(self, obj):
  81         """HTML link to user's revisions with count"""
  82         link = urlparams(reverse("dashboards.revisions"), user=obj.username)
  83         count = obj.created_revisions.count()
  84         return format_html('<a href="{}"><strong>{}</strong></a>', link, count)
  85 
  86 
  87 @admin.register(UserSubscription)
  88 class UserSubscriptionAdmin(admin.ModelAdmin):
  89     readonly_fields = ("user", "updated", "created", "stripe_subscription_id")
  90     list_display = ("user", "canceled", "updated", "created")
  91     search_fields = ("user__username",)
  92     list_filter = ("canceled", "created")
  93     ordering = ("updated",)
  94
  ```
  --- 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/kuma/users/admin.py b/kuma/users/admin.py
  --- a/kuma/users/admin.py
  +++ b/kuma/users/admin.py
  @@ -24,15 +24,18 @@
   
       def lookups(self, request, model_admin):
           return (
  -            (True, "Yes"),
  -            (False, "No"),
  +            ("yes", "Yes"),
  +            ("no", "No"),
           )
   
       def queryset(self, request, queryset):
  -        if self.value():
  +        value = self.value()
  +        if value == "yes":
               return queryset.exclude(stripe_customer_id="")
  -        else:
  +        elif value == "no":
               return queryset.filter(stripe_customer_id="")
  +        else:
  +            return queryset
   
   
   @admin.register(User)
  
verification_info: {"golden_diff": "diff --git a/kuma/users/admin.py b/kuma/users/admin.py\n--- a/kuma/users/admin.py\n+++ b/kuma/users/admin.py\n@@ -24,15 +24,18 @@\n \n     def lookups(self, request, model_admin):\n         return (\n-            (True, \"Yes\"),\n-            (False, \"No\"),\n+            (\"yes\", \"Yes\"),\n+            (\"no\", \"No\"),\n         )\n \n     def queryset(self, request, queryset):\n-        if self.value():\n+        value = self.value()\n+        if value == \"yes\":\n             return queryset.exclude(stripe_customer_id=\"\")\n-        else:\n+        elif value == \"no\":\n             return queryset.filter(stripe_customer_id=\"\")\n+        else:\n+            return queryset\n \n \n @admin.register(User)\n", "issue": "Django User admin not working related to stripe_customer_id\n**Summary**\r\n<img width=\"1450\" alt=\"Screen Shot 2020-05-20 at 1 01 52 PM\" src=\"https://user-images.githubusercontent.com/26739/82475221-28e5a080-9a9a-11ea-948f-be97bf2c15d6.png\">\r\n\r\nThere *exists* a user with that username. \r\nThe user is there. I can manually type in the URL http://localhost.org:8000/admin/users/user/1311/change/ and it works. \r\n\r\nIt's related to `IsStripeCustomer` in `kuma/users/admin.py`.\r\n\r\n**Steps To Reproduce (STR)**\r\n\r\n1. Have a user with and without a `stripe_customer_id`\r\n2. Go to http://localhost.org:8000/admin/users/user/\r\n3. Is the user appearing?\r\n\r\n\r\n**Actual behavior**\r\n_What actually happened?_\r\n\r\n\r\n**Expected behavior**\r\n_What did you expect to happen?_\r\n\r\n\r\n**Additional context**\r\nPretty sure it's the `IsStripeCustomer` thing that's filtering on the empty string even if you didn't filter on it. \n", "before_files": [{"content": "from django.contrib import admin\nfrom django.contrib.auth.admin import UserAdmin as BaseUserAdmin\nfrom django.utils.html import format_html\n\nfrom kuma.core.urlresolvers import reverse\nfrom kuma.core.utils import urlparams\n\nfrom .models import User, UserBan, UserSubscription\n\n\n@admin.register(UserBan)\nclass UserBanAdmin(admin.ModelAdmin):\n    fields = (\"user\", \"by\", \"reason\", \"is_active\")\n    list_display = (\"user\", \"by\", \"reason\", \"is_active\")\n    list_editable = (\"is_active\",)\n    list_filter = (\"is_active\",)\n    raw_id_fields = (\"user\", \"by\")\n    search_fields = (\"user__username\", \"reason\", \"by__username\")\n\n\nclass IsStripeCustomer(admin.SimpleListFilter):\n    title = \"is Stripe customer\"\n    parameter_name = \"is_stripe_customer\"\n\n    def lookups(self, request, model_admin):\n        return (\n            (True, \"Yes\"),\n            (False, \"No\"),\n        )\n\n    def queryset(self, request, queryset):\n        if self.value():\n            return queryset.exclude(stripe_customer_id=\"\")\n        else:\n            return queryset.filter(stripe_customer_id=\"\")\n\n\n@admin.register(User)\nclass UserAdmin(BaseUserAdmin):\n    \"\"\"\n    Extends the admin view of users to show date_joined field\n    add a filter on the field too\n    \"\"\"\n\n    fieldsets = BaseUserAdmin.fieldsets + (\n        (\"Subscription\", {\"fields\": (\"stripe_customer_id\", \"subscriber_number\")}),\n    )\n    readonly_fields = BaseUserAdmin.readonly_fields + (\n        \"stripe_customer_id\",\n        \"subscriber_number\",\n    )\n\n    list_display = (\n        \"username\",\n        \"fullname\",\n        \"email\",\n        \"revisions\",\n        \"date_joined\",\n        \"is_staff\",\n        \"is_active\",\n    )\n    list_filter = (\n        \"is_staff\",\n        \"is_superuser\",\n        \"is_active\",\n        \"date_joined\",\n        \"groups\",\n        IsStripeCustomer,\n    )\n    ordering = (\"-date_joined\",)\n    search_fields = (\n        \"username\",\n        \"title\",\n        \"fullname\",\n        \"organization\",\n        \"location\",\n        \"email\",\n    )\n\n    def revisions(self, obj):\n        \"\"\"HTML link to user's revisions with count\"\"\"\n        link = urlparams(reverse(\"dashboards.revisions\"), user=obj.username)\n        count = obj.created_revisions.count()\n        return format_html('<a href=\"{}\"><strong>{}</strong></a>', link, count)\n\n\n@admin.register(UserSubscription)\nclass UserSubscriptionAdmin(admin.ModelAdmin):\n    readonly_fields = (\"user\", \"updated\", \"created\", \"stripe_subscription_id\")\n    list_display = (\"user\", \"canceled\", \"updated\", \"created\")\n    search_fields = (\"user__username\",)\n    list_filter = (\"canceled\", \"created\")\n    ordering = (\"updated\",)\n", "path": "kuma/users/admin.py"}], "after_files": [{"content": "from django.contrib import admin\nfrom django.contrib.auth.admin import UserAdmin as BaseUserAdmin\nfrom django.utils.html import format_html\n\nfrom kuma.core.urlresolvers import reverse\nfrom kuma.core.utils import urlparams\n\nfrom .models import User, UserBan, UserSubscription\n\n\n@admin.register(UserBan)\nclass UserBanAdmin(admin.ModelAdmin):\n    fields = (\"user\", \"by\", \"reason\", \"is_active\")\n    list_display = (\"user\", \"by\", \"reason\", \"is_active\")\n    list_editable = (\"is_active\",)\n    list_filter = (\"is_active\",)\n    raw_id_fields = (\"user\", \"by\")\n    search_fields = (\"user__username\", \"reason\", \"by__username\")\n\n\nclass IsStripeCustomer(admin.SimpleListFilter):\n    title = \"is Stripe customer\"\n    parameter_name = \"is_stripe_customer\"\n\n    def lookups(self, request, model_admin):\n        return (\n            (\"yes\", \"Yes\"),\n            (\"no\", \"No\"),\n        )\n\n    def queryset(self, request, queryset):\n        value = self.value()\n        if value == \"yes\":\n            return queryset.exclude(stripe_customer_id=\"\")\n        elif value == \"no\":\n            return queryset.filter(stripe_customer_id=\"\")\n        else:\n            return queryset\n\n\n@admin.register(User)\nclass UserAdmin(BaseUserAdmin):\n    \"\"\"\n    Extends the admin view of users to show date_joined field\n    add a filter on the field too\n    \"\"\"\n\n    fieldsets = BaseUserAdmin.fieldsets + (\n        (\"Subscription\", {\"fields\": (\"stripe_customer_id\", \"subscriber_number\")}),\n    )\n    readonly_fields = BaseUserAdmin.readonly_fields + (\n        \"stripe_customer_id\",\n        \"subscriber_number\",\n    )\n\n    list_display = (\n        \"username\",\n        \"fullname\",\n        \"email\",\n        \"revisions\",\n        \"date_joined\",\n        \"is_staff\",\n        \"is_active\",\n    )\n    list_filter = (\n        \"is_staff\",\n        \"is_superuser\",\n        \"is_active\",\n        \"date_joined\",\n        \"groups\",\n        IsStripeCustomer,\n    )\n    ordering = (\"-date_joined\",)\n    search_fields = (\n        \"username\",\n        \"title\",\n        \"fullname\",\n        \"organization\",\n        \"location\",\n        \"email\",\n    )\n\n    def revisions(self, obj):\n        \"\"\"HTML link to user's revisions with count\"\"\"\n        link = urlparams(reverse(\"dashboards.revisions\"), user=obj.username)\n        count = obj.created_revisions.count()\n        return format_html('<a href=\"{}\"><strong>{}</strong></a>', link, count)\n\n\n@admin.register(UserSubscription)\nclass UserSubscriptionAdmin(admin.ModelAdmin):\n    readonly_fields = (\"user\", \"updated\", \"created\", \"stripe_subscription_id\")\n    list_display = (\"user\", \"canceled\", \"updated\", \"created\")\n    search_fields = (\"user__username\",)\n    list_filter = (\"canceled\", \"created\")\n    ordering = (\"updated\",)\n", "path": "kuma/users/admin.py"}]}