from django.db import models

from django.contrib.auth.models import User

from common.models import Audit, Comment

from farms.models import CropSeason, Field



########################################################
### NotificationsRule
###
### Connect notification info with a Field, CropSeason
########################################################

class NotificationsRule(Comment, Audit):

    # from Comment: comment
    # from Audit: cdate, cuser, mdate, muser

    NOTIFICATION_TYPE_VALUES    = ['SMS', 'Email']
    LEVEL_CHOICES               = ['Daily', 'Any Flag', 'Irrigate Today', 'None']

    field_list          = models.ManyToManyField(Field)
    recipients          = models.ManyToManyField(User)

    level               = models.CharField(max_length = 15)
    notification_type   = models.CharField(max_length = 15)


    

from django.db import models

from django.contrib.auth.models import User

from common.models import Audit, Comment

from farms.models import CropSeason, Field



########################################################
### NotificationsRule
###
### Connect notification info with a Field, CropSeason
########################################################

class NotificationsRule(Comment, Audit):

    # from Comment: comment
    # from Audit: cdate, cuser, mdate, muser

    NOTIFICATION_TYPE_VALUES    = ['Email', 'SMS']
    LEVEL_CHOICES               = ['Daily', 'Any Flag', 'Irrigate Today', 'None']

    field_list          = models.ManyToManyField(Field)
    recipients          = models.ManyToManyField(User)

    level               = models.CharField(max_length = 15)
    notification_type   = models.CharField(max_length = 15)


    

Change order of notification types so that email is shown first and becomes the default
Change order of notification types so that email is shown first and becomes the default

  from django.db import models
  
  from django.contrib.auth.models import User
  
  from common.models import Audit, Comment
  
  from farms.models import CropSeason, Field
  
  
  
  ########################################################
  ### NotificationsRule
  ###
  ### Connect notification info with a Field, CropSeason
  ########################################################
  
  class NotificationsRule(Comment, Audit):
  
      # from Comment: comment
      # from Audit: cdate, cuser, mdate, muser
  
-     NOTIFICATION_TYPE_VALUES    = ['SMS', 'Email']
+     NOTIFICATION_TYPE_VALUES    = ['Email', 'SMS']
      LEVEL_CHOICES               = ['Daily', 'Any Flag', 'Irrigate Today', 'None']
  
      field_list          = models.ManyToManyField(Field)
      recipients          = models.ManyToManyField(User)
  
      level               = models.CharField(max_length = 15)
      notification_type   = models.CharField(max_length = 15)
  
  
      
  
Change order of notification types so that email is shown first and becomes the default
## Code Before:
from django.db import models

from django.contrib.auth.models import User

from common.models import Audit, Comment

from farms.models import CropSeason, Field



########################################################
### NotificationsRule
###
### Connect notification info with a Field, CropSeason
########################################################

class NotificationsRule(Comment, Audit):

    # from Comment: comment
    # from Audit: cdate, cuser, mdate, muser

    NOTIFICATION_TYPE_VALUES    = ['SMS', 'Email']
    LEVEL_CHOICES               = ['Daily', 'Any Flag', 'Irrigate Today', 'None']

    field_list          = models.ManyToManyField(Field)
    recipients          = models.ManyToManyField(User)

    level               = models.CharField(max_length = 15)
    notification_type   = models.CharField(max_length = 15)


    

## Instruction:
Change order of notification types so that email is shown first and becomes the default
## Code After:
from django.db import models

from django.contrib.auth.models import User

from common.models import Audit, Comment

from farms.models import CropSeason, Field



########################################################
### NotificationsRule
###
### Connect notification info with a Field, CropSeason
########################################################

class NotificationsRule(Comment, Audit):

    # from Comment: comment
    # from Audit: cdate, cuser, mdate, muser

    NOTIFICATION_TYPE_VALUES    = ['Email', 'SMS']
    LEVEL_CHOICES               = ['Daily', 'Any Flag', 'Irrigate Today', 'None']

    field_list          = models.ManyToManyField(Field)
    recipients          = models.ManyToManyField(User)

    level               = models.CharField(max_length = 15)
    notification_type   = models.CharField(max_length = 15)


    
