Django specific permissions for users
<p>for example i have a model with booleanfield</p>

<pre><code>class Item(BaseModel):
    name = models.CharField(max_length=255)
    pending = models.BooleanField(default=False)
</code></pre>

<p>if user creates new item from admin panel pending field is false and this item won't display on website until other user  set this field into True, but this user mustn't be allowed to make change on pending field on his items but he can do this activity on other users items. any solutions?</p>

<p>There are a number of ways to implement this, depending on how you are ultimately going to end up using it. The most straightforward is to add a foreignkey on your Item to the user (assuming you use django auth).</p>

<pre><code>from django.contrib.auth.models import User
class Item(BaseModels):
    created_by = models.ForeignKey(User)
    name = models.CharField(max_length=255)
    pending = models.BooleanField(default=False)
</code></pre>

<p>assuming this only ever gets exposed via views, then you can just do:</p>

<pre><code>def some_view(request):
    if item_being_edited.created_by = request.user and not item_being_edited.pending:
         #rejection goes here
    #do stuff
</code></pre>

<p>as a sidenote, change your pending field. Either have pending = True mean an item is pending, or have it to be approved = False. It will make things easier later if it makes sense to read it in your head without gymnastics.</p>

python django