如何只为除django中的admin之外的所有用户创建一个字段

时间:2017-06-13 10:53:29

标签: python

我需要为除admin之外的所有用户进行read_manager字段readonly,因为他是分配的用户。 我的models.py

class Manager(models.Model):
  Manager_name = models.CharField(max_length=200)
  Manager_id =  models.IntegerField(default=0,primary_key=True)
  Email_id = models.EmailField(max_length=20,blank=True)
  def __unicode__(self):
      return unicode(self.Manager_id)` class Manager(models.Model):



class Request(models.Model):

  discussion_points = models.CharField(max_length=200)
  Request_id =  models.IntegerField(default=0,primary_key=True)
  companies = models.CharField(max_length=200)
  industry = models.CharField(max_length=200)
  Functional_area= models.CharField(max_length=200)
  Budget = models.IntegerField(default=0)
  status = models.CharField(max_length=5, choices=STATUS_CHOICES, default='d')
  Assign_manager =models.ForeignKey(Manager,blank=True,null=True)
  Assign_executive= models.ForeignKey(Executive,null=True,on_delete=models.CASCADE,default='none',blank=True)
  Rateperhour=models.IntegerField(blank=True,default=5,null=True)
  linkedin_url = models.URLField(max_length=200, blank=True)

0 个答案:

没有答案