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 optional readonly setting for slug and date #8

Open
toddstowell opened this issue Apr 25, 2012 · 1 comment
Open

Add optional readonly setting for slug and date #8

toddstowell opened this issue Apr 25, 2012 · 1 comment

Comments

@toddstowell
Copy link

I have several users who find it necessary to modify the slug on a blog entry after the story is active and trending via google news. I would love to see an optional setting that we can set to make the slug and also the date / time stamp fields read only so they cannot be messed with after the item has been published. Perhaps we can allow admins to still modify the fields if needed, but writers should in now way be allowed to change these fields once something has been pushed.

@jsoa
Copy link
Member

jsoa commented May 3, 2012

I believe this is a little out of scope for this app. Its more a management issue then a viewpoint issue. I would suggest simply creating your own viewpoint admin that provides the functionality. Here is a small example...

class MyCustomVewipointAdmin(admin.ModelAdmin):
    def get_readonly_fields(self, request, obj=None):
        if not obj:
            return self.readonly_fields
        elif not request.user.is_superuser:
            return self.readonly_fields + ('slug', 'date', 'other', 'etc')
        return self.readonly_fields

This snippet was written right here and not tested in anyway, but your real implementation should look similar

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

2 participants