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