first commit
This commit is contained in:
		
						commit
						b71ea45681
					
				
					 898 changed files with 138202 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								accounts/management/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								accounts/management/__init__.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
# Management package for accounts app 
 | 
			
		||||
							
								
								
									
										1
									
								
								accounts/management/commands/__init__.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								accounts/management/commands/__init__.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
# Commands package for accounts app 
 | 
			
		||||
							
								
								
									
										51
									
								
								accounts/management/commands/create_roles.py
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								accounts/management/commands/create_roles.py
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
from django.core.management.base import BaseCommand
 | 
			
		||||
 | 
			
		||||
from accounts.models import Role
 | 
			
		||||
from common.consts import UserRoles
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Command(BaseCommand):
 | 
			
		||||
    help = "Generates default roles"
 | 
			
		||||
 | 
			
		||||
    def handle(self, *args, **options):
 | 
			
		||||
        roles = [
 | 
			
		||||
            {
 | 
			
		||||
                "name": "ادمین",
 | 
			
		||||
                "slug": UserRoles.ADMIN,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "مشترک",
 | 
			
		||||
                "slug": UserRoles.CUSTOMER,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "مدیر",
 | 
			
		||||
                "slug": UserRoles.MANAGER,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "حسابدار",
 | 
			
		||||
                "slug": UserRoles.ACCOUNTANT,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "پیشخوان",
 | 
			
		||||
                "slug": UserRoles.BROKER,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "نصاب",
 | 
			
		||||
                "slug": UserRoles.INSTALLER,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "کارشناس امور",
 | 
			
		||||
                "slug": UserRoles.REGIONAL_WATER_AUTHORITY,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "مدیر منابع آب",
 | 
			
		||||
                "slug": UserRoles.WATER_RESOURCE_MANAGER,
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "name": "ستاد آبمنطقهای",
 | 
			
		||||
                "slug": UserRoles.HEADQUARTER,
 | 
			
		||||
            },
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        for role in roles:
 | 
			
		||||
            Role.objects.get_or_create(name=role['name'], slug=role['slug'].value)
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue