Repository: jazzband/django-ical (language: python)

Issue:
CATEGORIES shows up in feed twice.
Since updating to the latest version, CATEGORIES shows up in my feed twice.
It is listed twice in ITEM_ELEMENT_FIELD_MAP on line 63 and line 77 which might be the cause of the problem.

https://github.com/jazzband/django-ical/blob/0c32c51c7336946fe87b477873904391bf1fb74c/django_ical/feedgenerator.py#L63


Discussion / hints:
Thanks for reporting! Yeah there seem to be two entries for categories. Would you happen to have the change of making a PR for fixing this?

Fix patch:
diff --git a/django_ical/feedgenerator.py b/django_ical/feedgenerator.py
index 1c0b4b2..f3aaa8b 100644
--- a/django_ical/feedgenerator.py
+++ b/django_ical/feedgenerator.py
@@ -74,7 +74,6 @@
     ("percent_complete", "percent-complete"),
     ("priority", "priority"),
     ("due", "due"),
-    ("categories", "categories"),
 )
 
 class ICal20Feed(SyndicationFeed):


Test patch:
diff --git a/django_ical/tests/test_feed.py b/django_ical/tests/test_feed.py
index b2e111d..4d45348 100644
--- a/django_ical/tests/test_feed.py
+++ b/django_ical/tests/test_feed.py
@@ -97,6 +97,7 @@ def items(self):
                     "email": "john.doe@example.com",
                     "role": "CHAIR",
                 },
+                "categories": ['Cat1', 'Cat2'],
                 "alarms": [
                     {
                         "trigger": timedelta(minutes=-30),
@@ -376,6 +377,9 @@ def test_items(self):
             calendar.subcomponents[1]["ORGANIZER"].to_ical(),
             b"MAILTO:john.doe@example.com",
         )
+        self.assertEqual(
+            calendar.subcomponents[1]["CATEGORIES"].to_ical(), b"Cat1,Cat2"
+        )
         self.assertIn(
             b"BEGIN:VALARM\r\nACTION:DISPLAY\r\nDESCRIPTION:Alarm2a\r\nTRIGGER:-PT30M\r\nEND:VALARM\r\n",
             [comp.to_ical() for comp in calendar.subcomponents[1].subcomponents],
@@ -407,7 +411,7 @@ def test_items(self):
             calendar.subcomponents[2]["PRIORITY"].to_ical(), b"1"
         )
         self.assertEqual(
-            calendar.subcomponents[2]["CATEGORIES"][0].to_ical(), b"CLEANING"
+            calendar.subcomponents[2]["CATEGORIES"].to_ical(), b"CLEANING"
         )
         self.assertEqual(
             calendar.subcomponents[2]["PERCENT-COMPLETE"].to_ical(), b"89"