Commit 2c0d339f authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add script to create Accessible areas

parent 1d89e247
from 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'
def handle(self, *args, **options):
areas = {
'Forums': 'forums',
'Messages': 'messages',
'Courses': 'courses',
'Classrooms': 'classrooms',
'Notes': 'notes',
'Profile Page': 'profile-page',
'Chat Main Page': 'chat-main-page',
'Dashboard': 'dashboard'
for name, slug in areas.items():
a, created = AccessibleArea.objects.get_or_create(name=name, slug=slug)
if created:
print('Created area {}'.format(name))
print('Area {} already exists. Skipping creation...'.format(name))
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