예제 #1
0
class Activity(models.Model):
    organizer = models.ForeignKey(Organizer, on_delete=models.CASCADE)
    students = models.ManyToManyField(Student, through='Confirm_state')
    name = ff.EncryptedCharField(max_length=200)
    description = models.CharField(max_length=200)
    major = ff.EncryptedCharField(max_length=200)
    start_date = models.DateTimeField('Date', default=datetime.datetime.now)
    time_worth = ff.EncryptedIntegerField(default=1)
    place = models.CharField(max_length=200)
    number_of_volunteers = models.IntegerField(default=1)
예제 #2
0
class Organizer(models.Model):
    UserName = models.CharField(max_length=200, unique=True)
    FirstName = models.CharField(max_length=200)
    LastName = models.CharField(max_length=200)
    email = models.EmailField()
    password = ff.EncryptedCharField(max_length=200)

    def __str__(self):
        return self.UserName
예제 #3
0
class Student(models.Model):
    ID = models.CharField(max_length=200, unique=True)
    password = ff.EncryptedCharField(max_length=200)
    Name = models.CharField(max_length=200)
    LastName = models.CharField(max_length=200)
    email = models.EmailField()
    major = models.CharField(
        max_length=20,
        choices=Major_Choices,
        default='Math',
    )
    cuota = models.IntegerField(default=50)
예제 #4
0
class SlackWorkspaceEmojiWatcher(VersionedModel):
    """
    Class to stores the data associated with a particular team.
    """

    # ---- Inner classes -------------------------------------------------

    class Meta(object):
        verbose_name = 'Slack Workspace Emoji Watcher'

    # ---- Properties ----------------------------------------------------

    team_id = d_d_models.CharField(
        default='T',
        max_length=TEAM_ID_MAX_LEN,
        null=False,
        unique=True,
        validators=[
            d_c_validators.RegexValidator(
                TEAM_ID_RE,
                message=gettext('Must be of the format (e.g.) T123ABC...')),
        ],
        verbose_name=gettext('Team ID'),
    )

    team_id.short_description = gettext('Slack Team ID (e.g., T123ABC...)')

    access_token = fernet_fields.EncryptedCharField(
        default='xoxa-',
        max_length=ACCESS_TOKEN_MAX_LEN,
        null=False,
        validators=[
            d_c_validators.RegexValidator(
                ACCESS_TOKEN_RE,
                message=gettext(
                    'Must be of the format (e.g.) xoxa-1f2e3d-4c5b6a...')),
        ],
        verbose_name=gettext('Access Token'),
    )

    access_token.short_description = gettext(
        'Slack OAuth access token (e.g., xoxa-1f2e3d-4c5b6a...)')

    channel_id = d_d_models.CharField(
        default='C',
        max_length=CHANNEL_ID_MAX_LEN,
        null=False,
        validators=[
            d_c_validators.RegexValidator(
                CHANNEL_ID_RE,
                message=gettext('Must be of the format (e.g.) C123ABC...')),
        ],
        verbose_name=gettext('Channel ID'),
    )

    channel_id.short_description = gettext(
        'Slack Channel ID (e.g., C123ABC...)')

    icon_emoji = d_d_models.CharField(
        default=ICON_EMOJI_DEFAULT,
        max_length=ICON_EMOJI_MAX_LEN,
        null=False,
        validators=[
            d_c_validators.RegexValidator(
                ICON_EMOJI_RE,
                message=gettext(
                    'Must be of the format (e.g.) :emoji_name:...')),
        ],
        verbose_name=gettext('Icon Emoji'),
    )

    icon_emoji.short_description = gettext('Icon Emoji (e.g., {}...)').format(
        ICON_EMOJI_DEFAULT)

    notes = fernet_fields.EncryptedTextField(
        blank=True,
        default='',
    )

    notes.short_description = gettext('Your Notes (not transmitted)').format(
        ICON_EMOJI_DEFAULT)
예제 #5
0
class Requester(models.Model):
    # EncryptedCharField cannot serve as a primary key or lookup field
    aws_account = models.CharField(max_length=200, primary_key=True)
    key = fernet_fields.EncryptedCharField(max_length=200)
    secret = fernet_fields.EncryptedCharField(max_length=200)
    email = fernet_fields.EncryptedEmailField(blank=True, null=True)