Quick Fix  - The Teacher model had a typo. Here is the fix

*class Teacher(models.Model):*
*    name = models.CharField(max_length=200)*
*    subject= models.ForeignKey('Subject')*
*    topic= models.ForeignKey('**Topic**')*
*    text = models.TextField()*

*What I am trying to do or (would like to do) is allow a bunch of users the 
ability to modify certain objects . Something exactly like the admin 
interface , however limiting the changes they can make to an object.*
 

On Thursday, January 26, 2017 at 1:58:57 PM UTC-8, Mike08 wrote:
>
> Hello experts first time poster here, so I am not sure how to approach 
> this issue. I am trying to restrict admin privileges of users.
> Let me explain a simple use case and then I could explain my objective. 
> Consider the following example (model code below) there are 3 
> subjects(Subject Model) in the database suppose these are (Math , physics , 
> chemistry)
> Now each teacher (Teacher model) is assigned a Subject (subject Model). 
> Now each Teacher should have an admin section they should not be able to 
> change their name, they should not be able to change their subject but they 
> can create new topics that they would like to discuss in their class(Topic 
> Model). My question is what would be the best approach to handle this. 
>
> Example:
>
> *class Subject(models.Model):*
> *    name = models.CharField(max_length=200)*
> *    text   = models.CharField(max_length=200)*
>
> *class Topic(models.Model)*
> *    topic_name = models.CharField(max_length=200)*
>
> *class Teacher(models.Model):*
> *    name = models.CharField(max_length=200)*
> *    subject= models.ForeignKey('Subject')*
> *    topic= models.ForeignKey('Subject')*
> *    text = models.TextField()*
>
>
> Now inorder to handle this should I create a separate admin for the 
> teachers (like below )? If so how do I limit the models they should not be 
> able to see other teachers in the system. Only themselves ?
>
>
> *from django.contrib.admin.sites import AdminSite*
>
> *class TeacherAdminSite(AdminSite):*
> *    pass*
> *    #or overwrite some methods for different functionality*
>
> *teachAdmin= TeacherAdminSite(name="teachadmin") *
>
>
>
> Any suggestions on how I could solve this problem ? Or any other approach 
> that I can take ?
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d51c083a-af63-4504-a902-04a465555ef0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to