Django admin site for limited privilege users -


i have django application, , have 2 apps within project: accounts , store. in store app, have product, category model , other models.

i have admin site, can register products. in accounts, allow general people signup , log in.

now, want users able register products, can sell own products. however, not want give them complete access admin site.

how can give such limited access admin site general users?

thanks.

in admin can make groups , assign access models wanted , same applied users might interested in limited access models records logged user have added. in order achieve have define 1 column in model foreign key users below have defined model company , assigned each company user:

class company(models.model):

name = models.charfield(max_length=64, primary_key=true) kam = models.foreignkey(user, verbose_name='kam', blank=true, null=true) address = models.textfield(blank=true, null=true) city = models.charfield(max_length=32, blank=true, null=true) country = models.charfield(max_length=32, blank=true, null=true) phone  = models.charfield(max_length=32, blank=true, null=true) fax  = models.charfield(max_length=32, blank=true, null=true) url = models.urlfield(blank=true, null=true)   class meta:     verbose_name_plural = 'companies'     #unique_together = (('name', 'kam'),).  def __unicode__(self):     return self.name 

now model associated user, restrict records loaded according logged user using admin.py in modeladmin definition given below:

def queryset(self, request):     qs = super(companyadmin, self).queryset(request)     # if super-user, show comments     if request.user.is_superuser:         return qs     return qs.filter(kam=request.user) 

thats simple let me know if want?

also assign read right. in model admin


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -