from django.core.management import BaseCommand
from django.contrib.auth.models import Group


class Command(BaseCommand):

    def handle(self, *args, **options):
        Group.objects.get_or_create(
            name="County Health Records Information Officer")
        Group.objects.get_or_create(
            name="Sub County Health Records Information Officer")
        Group.objects.get_or_create(
            name="National Users")

@@ -85,16 +85,49 @@
 t Group%0A
+from users.models import MflUser%0A
 %0A%0Aclass 
@@ -188,32 +188,49 @@
 ptions):%0A       
+ chrio, created =
  Group.objects.g
@@ -304,32 +304,50 @@
 fficer%22)%0A       
+ schrio, created =
  Group.objects.g
@@ -433,16 +433,36 @@
 %0A       
+ national, created =
  Group.o
@@ -518,8 +518,1082 @@
 Users%22)%0A
+%0A        national_user = MflUser.objects.get(%0A            email='national@mfltest.slade360.co.ke')%0A        national_user.groups.add(national)%0A        chrio_user = MflUser.objects.get(%0A            email='chrio@mfltest.slade360.co.ke')%0A        chrio_user.groups.add(chrio)%0A        schrio_user = MflUser.objects.get(%0A            email='schrio@mfltest.slade360.co.ke')%0A        schrio_user.groups.add(schrio)%0A        mombasa_user = MflUser.objects.get(%0A            email='mombasa@mfltest.slade360.co.ke')%0A        mombasa_user.groups.add(chrio)%0A        kilifi_user = MflUser.objects.get(%0A            email='kilifi@mfltest.slade360.co.ke')%0A        kilifi_user.groups.add(chrio)%0A        tanriver_user = MflUser.objects.get(%0A            email='tanariver@mfltest.slade360.co.ke')%0A        tanriver_user.groups.add(chrio)%0A        narok_user = MflUser.objects.get(%0A            email='narok@mfltest.slade360.co.ke')%0A        narok_user.groups.add(chrio)%0A        nairobi_user = MflUser.objects.get(%0A            email='nairobi@mfltest.slade360.co.ke')%0A        nairobi_user.groups.add(chrio)%0A

Add users to groups