Ticket #15809: add_object_has_add_perm.diff
File add_object_has_add_perm.diff, 1.7 KB (added by , 14 years ago) |
---|
-
docs/ref/contrib/admin/index.txt
954 954 kwargs['choices'] += (('ready', 'Ready for deployment'),) 955 955 return super(MyModelAdmin, self).formfield_for_choice_field(db_field, request, **kwargs) 956 956 957 .. method:: ModelAdmin.has_add_permission(self, request )957 .. method:: ModelAdmin.has_add_permission(self, request, obj=None) 958 958 959 959 Should return ``True`` if adding an object is permitted, ``False`` 960 960 otherwise. -
django/contrib/admin/options.py
347 347 return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js]) 348 348 media = property(_media) 349 349 350 def has_add_permission(self, request ):350 def has_add_permission(self, request, obj=None): 351 351 """ 352 352 Returns True if the given request has permission to add an object. 353 353 Can be overriden by the user in subclasses. … … 682 682 context.update({ 683 683 'add': add, 684 684 'change': change, 685 'has_add_permission': self.has_add_permission(request ),685 'has_add_permission': self.has_add_permission(request, obj), 686 686 'has_change_permission': self.has_change_permission(request, obj), 687 687 'has_delete_permission': self.has_delete_permission(request, obj), 688 688 'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,