Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 718037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:28:51+00:00 2026-05-14T05:28:51+00:00

I suppose similar problem would have been discussed here, but I couldn’t find it.

  • 0

I suppose similar problem would have been discussed here, but I couldn’t find it.

Let’s suppose I have an Editor and a Supervisor. I want the Editor to be able to add new content (eg. a news post) but before publication it has to be acknowledged by Supervisor.

When Editor lists all items, I want to set some fields on the models (like an ‘ack’ field) as read-only (so he could know what had been ack’ed and what’s still waiting approval) but the Supervisor should be able to change everything (list_editable would be perfect)

What are the possible solutions to this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:28:51+00:00Added an answer on May 14, 2026 at 5:28 am

    I think there is a more easy way to do that:

    Guest we have the same problem of Blog-Post

    blog/models.py:

    Class Blog(models.Model):
         ...
         #fields like autor, title, stuff..
         ...
    
    class Post(models.Model):
         ...
         #fields like blog, title, stuff..
         ...
         approved = models.BooleanField(default=False)
         approved_by = models.ForeignKey(User) 
         class Meta:
             permissions = (
                 ("can_approve_post", "Can approve post"),
             )
    

    And the magic is in the admin:

    blog/admin.py:

    ...
    from django.views.decorators.csrf import csrf_protect
    ...
    def has_approval_permission(request, obj=None):
         if request.user.has_perm('blog.can_approve_post'):
             return True
         return False
    
    Class PostAdmin(admin.ModelAdmin):
         @csrf_protect
         def changelist_view(self, request, extra_context=None):
             if not has_approval_permission(request):
                 self.list_display = [...] # list of fields to show if user can't approve the post
                 self.editable = [...]
             else:
                 self.list_display = [...] # list of fields to show if user can approve the post
             return super(PostAdmin, self).changelist_view(request, extra_context)
         def get_form(self, request, obj=None, **kwargs):
             if not has_approval_permission(request, obj):
                 self.fields = [...] # same thing
             else:
                 self.fields = ['approved']
             return super(PostAdmin, self).get_form(request, obj, **kwargs)
    

    In this way you can use the api of custom permission in django, and you can override the methods for save the model or get the queryset if you have to. In the methid has_approval_permission you can define the logic of when the user can or can’t to do something.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Referring on this question , I have a similar -but not the same- problem..
I suppose similar questions were already asked, but I was unable to find any.
I suppose this might be similar to this question , but I'm wondering if
My problem is similar to the one in this question, but the opposite. How
Suppose I have no network card installed on my computer, and I would like
I did find other posts similar to this, but wanted a little extra information
Suppose we have a class which can be serialized/deserialized by XmlSerializer. It would be
I have a gtk.TextBuffer which is supposed to be cleared after pressing Enter, similar
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX
Suppose I have a stringbuilder in C# that does this: StringBuilder sb = new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.