For the sake of simplicity let's suppose I have
models.py
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
Under admin I would like that some username (say "vic" and "lucky") can edit
every field of the change form while other users ("tom","sue") can only
visualize the same data without modification. I think to put some "if
condition" in admin.py of this kind
class BookOption(admin.ModelAdmin):
if username in ["tom", "sue"]:
readonly_fields = ['title','authors','publisher']
fields=(('title'),('authors', 'publisher'))..
.....
admin.site.register(Book,BookOption)
How can I do it?
Ciao
Vittorio
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/F0A087D2-8E11-4B0B-8D95-6FC131854994%40de-martino.it.
For more options, visit https://groups.google.com/groups/opt_out.