SEBA-465 many2many should not have null= set

Change-Id: I6293e768cfc32bfbbec4fe29a27f1d0ee21fb344
diff --git a/lib/xos-genx/xosgenx/jinja2_extensions/django.py b/lib/xos-genx/xosgenx/jinja2_extensions/django.py
index d71ea51..724b85d 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/django.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/django.py
@@ -101,10 +101,18 @@
         "max_value",
     ]
 
-    # TODO evaluate if setting Null = False for all strings
-    m = {
-        "modifier": {"optional": True, "required": False, "_targets": ["null", "blank"]}
-    }
+    if f.get("link_type") == "manytomany":
+        # map for fields that do not support null
+        m = {
+            "modifier": {"optional": True, "required": False, "_targets": ["blank"]}
+        }
+    else:
+        # map for fields that do support null
+        # TODO evaluate if setting Null = False for all strings
+        m = {
+            "modifier": {"optional": True, "required": False, "_targets": ["null", "blank"]}
+        }
+
     out = {}
 
     for k, v in f["options"].items():
@@ -122,6 +130,8 @@
 
 
 def xproto_django_link_options_str(field, dport=None):
+    # Note that this function is called for links (ForeignKeys, M2Ms)
+
     output_dict = map_xproto_to_django(field)
 
     if dport and (dport == "+" or "+" not in dport):
@@ -203,6 +213,8 @@
 
 
 def xproto_django_options_str(field, dport=None):
+    # This function is called for non-links (Strings, Ints, Booleans, ...)
+
     output_dict = map_xproto_to_django(field)
 
     if dport == "_":