Commit b8a6e3da authored by Matheus Miranda's avatar Matheus Miranda
Browse files

rename command to create accessible areas

parent 3f4891a3
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
from django.db import transaction
from courses.stats.models import AccessibleArea
class Command(BaseCommand):
help = 'Create AccessibleArea'
@transaction.atomic
def handle(self, *args, **options):
areas = {
'forums': {'name_en': 'Forums', 'name_pt_br': 'Fóruns', 'name_es': 'Foros'},
'messages': {'name_en': 'Messages', 'name_pt_br': 'Avisos', 'name_es': 'Notificaciones'},
'courses': {'name_en': 'Courses', 'name_pt_br': 'Cursos', 'name_es': 'Cursos'},
'classrooms': {'name_en': 'Classrooms', 'name_pt_br': 'Salas', 'name_es': 'Aulas'},
'notes': {'name_en': 'Notes', 'name_pt_br': 'Notas', 'name_es': 'Notas'},
'profile-page': {'name_en': 'Profile Page', 'name_pt_br': 'Página de perfil', 'name_es': 'Página de perfil'},
'chat-main-page': {'name_en': 'Chats page', 'name_pt_br': 'Página de chats', 'name_es': 'Página de chats'},
'dashboard': {'name_en': 'Dashboard', 'name_pt_br': 'Painel', 'name_es': 'Panel'}
}
for slug, attrs in areas.items():
a, created = AccessibleArea.objects.get_or_create(slug=slug)
attrs['slug_en'] = slug
attrs['slug_pt_br'] = slug
attrs['slug_es'] = slug
AccessibleArea.objects.filter(id=a.id).update(**attrs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment