本文整理汇总了Python中people.models.Person.is_staff方法的典型用法代码示例。如果您正苦于以下问题:Python Person.is_staff方法的具体用法?Python Person.is_staff怎么用?Python Person.is_staff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类people.models.Person
的用法示例。
在下文中一共展示了Person.is_staff方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from people.models import Person [as 别名]
# 或者: from people.models.Person import is_staff [as 别名]
def handle(self, *options, **kwoptions):
if len(options) != 1:
raise CommandError('Must provide a file')
with open(options[0]) as f:
for line in f:
line = line.strip()
# ingore blank lines
if line == '':
continue
(last_name, first_name, email, username) = line.split(' ')
password_chars = string.ascii_lowercase + string.digits
password = ''.join(random.choice(password_chars)
for x in range(6))
person = Person(first_name = first_name,
last_name = last_name,
username = username,
email = email)
person.set_password(password)
person.is_staff = True
person.is_superuser = True
mail_text = EMAIL_TEXT % (first_name, username, password)
send_mail('Welcome to ROSEdu People',
mail_text,
'[email protected]',
[email])
person.save()
print 'Invited %s %s' % (first_name, last_name)