Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button visible in inline when add permissions are false #316

Closed
parsch opened this issue Apr 12, 2013 · 1 comment
Closed

Add button visible in inline when add permissions are false #316

parsch opened this issue Apr 12, 2013 · 1 comment
Assignees

Comments

@parsch
Copy link
Collaborator

parsch commented Apr 12, 2013

as reported here http://stackoverflow.com/questions/15966633/django-grappelli-add-button-visible-in-inline-when-add-permissions-are-false#new-answer

class FieldInline(admin.TabularInline):
    model = models.Field
    classes = ('grp-collapse grp-closed',)

    fields = ('number', 'year', 'area')
    extra = 0

    def has_add_permission(self, request):
        return False

    def has_delete_permission(self, request, obj):
        return False

The add button appears when the inline formset is collapsed, but disappears when its open.

@parsch
Copy link
Collaborator Author

parsch commented Apr 12, 2013

The add-button is hidden via jquery.grp_inline.js depending on TOTAL_FORMS and MAX_NUM_FORMS (it's not asking for permissions there). Anyway, the hidden add-button with display: none was still visible as grp-tools items in .gpr-closed need the property display: block !important. I fixed that via css with really hiding such hidden buttons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant