disable inline adding for dossier
authorOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 5 Jan 2012 17:51:27 +0000 (12:51 -0500)
committerOlivier Larchevêque <olivier.larcheveque@auf.org>
Thu, 5 Jan 2012 17:51:27 +0000 (12:51 -0500)
project/rh/lib.py
project/rh/templates/admin/linked.html

index 4af6ab6..496afba 100644 (file)
@@ -90,7 +90,7 @@ class DossierROInline(ReadOnlyInlineMixin, LinkedInline):
     extra = 0
     can_delete = False
 
-    def has_add_permission(self, request):
+    def has_add_permission(self, request=None):
         return False
 
     def has_change_permission(self, request, obj=None):
index e411327..99f395d 100644 (file)
                 }
             });
         }
+        {% if inline_admin_formset.formset.has_add_permission != False %}
         $(rows).formset({
             prefix: "{{ inline_admin_formset.formset.prefix }}",
             addText: "{% blocktrans with inline_admin_formset.opts.verbose_name|title as verbose_name %}Add another {{ verbose_name }}{% endblocktrans %}",
                 alternatingRows(row);
             })
         });
+        {% endif %}
     });
 })(django.jQuery);
 </script>