示例#1
0
 def make_data_scientist(self, request, queryset):
     from pythonpro.domain import user_facade
     for user in queryset:
         try:
             user_facade.promote_data_scientist(user, 'django_admin')
         except UserRoleException:
             pass  # No need to handle on admin
def _promote(user, slug: str):
    if slug.startswith('membership'):
        user_facade.promote_member(user, 'unknown')
    elif slug.startswith('webdev'):
        user_facade.promote_webdev(user, 'unknown')
    elif slug.startswith('data-science'):
        user_facade.promote_data_scientist(user, 'unknown')
    else:
        raise ValueError(f'{slug} should contain webdev or membership')
示例#3
0
def _promote(user, slug: str):
    if slug.startswith('membership'):
        user_facade.promote_member(user, 'unknown')
    elif slug == 'pacote-proximo-nivel-67-discount':
        user_facade.promote_pythonista(user, 'unknown')
    elif slug.startswith('webdev'):
        user_facade.promote_webdev(user, 'unknown')
    elif slug.startswith('data-science'):
        user_facade.promote_data_scientist(user, 'unknown')
    elif slug in {'bootcamp', 'bootcamp-webdev'}:
        user_facade.promote_bootcamper(user, 'unknown')
        user_facade.promote_pythonista(user, 'unknown')
    elif slug.startswith('bootcamp'):
        user_facade.promote_bootcamper(user, 'unknown')
    else:
        raise ValueError(f'{slug} should contain webdev or membership or data-science')