Exemple #1
0
class User(PermissionsMixin, AbstractBaseUser):
    digest_field = fields.TextDigestField(blank=True, default='')
    digest_with_original_field = fields.TextDigestField(original='', default='')
    hmac_field = fields.TextHMACField(blank=True, default='')
    hmac_with_original_field = fields.TextHMACField(original='', default='')
    varopago_id = fields.TextPGPSymmetricKeyField(editable=False, blank=False, default='-')
    username = fields.CharPGPSymmetricKeyField(max_length=255, blank=False, null=False, unique=True, default='')
    name = fields.CharPGPSymmetricKeyField(max_length=200, blank=False, null=False, default='')
    second_name = fields.CharPGPSymmetricKeyField(max_length=200, blank=False, null=False, default='')
    first_lastname = fields.CharPGPSymmetricKeyField(max_length=250, blank=True, null=True, default='')
    second_lastname = fields.CharPGPSymmetricKeyField(max_length=250, blank=True, null=True, default='')
    country = fields.CharPGPSymmetricKeyField(max_length=250, blank=True, null=True, default='')
    email = fields.EmailPGPSymmetricKeyField(unique=True)
    phone = fields.CharPGPSymmetricKeyField(max_length=200, blank=False, null=False, default='')
    rol = fields.CharPGPSymmetricKeyField(max_length=255, blank=True, null=True, default='')
    avatar = fields.TextPGPSymmetricKeyField(blank=True, null=True, default='')
    banner = fields.TextPGPSymmetricKeyField(blank=True, null=True, default='')
    plan = models.ForeignKey(Plan, related_name='user_plan', null=True, blank=True,
                             on_delete=models.SET_NULL)
    plan_payment = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, null=True, editable=True)
    plan_paid_lenght = fields.IntegerPGPSymmetricKeyField(blank=True, null=True, default=0)
    plan_expiration = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    invitation_code = fields.CharPGPSymmetricKeyField(max_length=255, blank=True, null=True, default='')
    is_staff_varopago = fields.IntegerPGPSymmetricKeyField(blank=True, null=True, default=0)
    is_staff_dev = fields.IntegerPGPSymmetricKeyField(blank=True, null=True, default=0)
    is_active_user = fields.IntegerPGPSymmetricKeyField(blank=True, null=True, default=1)
    date_joined = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=False)
    is_active = models.BooleanField(default=True)
    is_staff = models.BooleanField(default=True)
    date_joined = models.DateTimeField(default=now, blank=False, editable=False)
    address = fields.TextPGPSymmetricKeyField(blank=False, default='')
    activation_code = fields.TextPGPSymmetricKeyField(blank=False, default='')
    kyc = JSONField(default=dict)
    previous_reference = fields.TextPGPSymmetricKeyField(blank=False, default='')
    reference = fields.TextPGPSymmetricKeyField(blank=False, default='')

    objects = UserManager()

    def __str__(self):
        return self.email

    def save(self, *args, **kwargs):
        super(User, self).save(*args, **kwargs)

    class Meta:
        app_label = 'accounts'

    USERNAME_FIELD = 'email'
Exemple #2
0
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True,
                                                           null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True,
                                                               null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
    date_pgp_sym_field = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    datetime_pgp_sym_field = fields.DateTimePGPSymmetricKeyField(blank=True,
                                                                 null=True)
    time_pgp_sym_field = fields.TimePGPSymmetricKeyField(blank=True, null=True)
    decimal_pgp_sym_field = fields.DecimalPGPSymmetricKeyField(
        max_digits=8, decimal_places=2, null=True, blank=True)
    float_pgp_sym_field = fields.FloatPGPSymmetricKeyField(blank=True,
                                                           null=True)

    fk_model = models.ForeignKey(EncryptedFKModel,
                                 blank=True,
                                 null=True,
                                 on_delete=models.CASCADE)

    class Meta:
        """Sets up the meta for the test model."""
        app_label = 'tests'
Exemple #3
0
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    digest_with_original_field = fields.TextDigestField(
        blank=True, null=True, original='pgp_sym_field')
    hmac_field = fields.TextHMACField(blank=True, null=True)
    hmac_with_original_field = fields.TextHMACField(blank=True,
                                                    null=True,
                                                    original='pgp_sym_field')

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True, null=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True,
                                                            null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True,
                                                           null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True,
                                                               null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
    date_pgp_sym_field = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    datetime_pgp_sym_field = fields.DateTimePGPSymmetricKeyField(blank=True,
                                                                 null=True)

    class Meta:
        app_label = 'tests'
Exemple #4
0
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    digest_with_original_field = fields.TextDigestField(
        blank=True, null=True, original='pgp_sym_field')
    hmac_field = fields.TextHMACField(blank=True, null=True)
    hmac_with_original_field = fields.TextHMACField(blank=True,
                                                    null=True,
                                                    original='pgp_sym_field')

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True,
                                                        null=True,
                                                        unique=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True,
                                                            null=True)
    biginteger_pgp_pub_field = fields.BigIntegerPGPPublicKeyField(blank=True,
                                                                  null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)
    char_pub_field = fields.CharPGPPublicKeyField(blank=True,
                                                  null=True,
                                                  max_length=15)
    date_pgp_pub_field = fields.DatePGPPublicKeyField(blank=True, null=True)
    datetime_pgp_pub_field = fields.DateTimePGPPublicKeyField(blank=True,
                                                              null=True)
    time_pgp_pub_field = fields.TimePGPPublicKeyField(blank=True, null=True)
    decimal_pgp_pub_field = fields.DecimalPGPPublicKeyField(max_digits=8,
                                                            decimal_places=2,
                                                            null=True,
                                                            blank=True)
    float_pgp_pub_field = fields.FloatPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True,
                                                           null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True,
                                                               null=True)
    biginteger_pgp_sym_field = fields.BigIntegerPGPSymmetricKeyField(
        blank=True, null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
    char_sym_field = fields.CharPGPPublicKeyField(blank=True,
                                                  null=True,
                                                  max_length=15)
    date_pgp_sym_field = fields.DatePGPSymmetricKeyField(blank=True, null=True)
    datetime_pgp_sym_field = fields.DateTimePGPSymmetricKeyField(blank=True,
                                                                 null=True)
    time_pgp_sym_field = fields.TimePGPSymmetricKeyField(blank=True, null=True)
    decimal_pgp_sym_field = fields.DecimalPGPSymmetricKeyField(
        max_digits=8, decimal_places=2, null=True, blank=True)
    float_pgp_sym_field = fields.FloatPGPSymmetricKeyField(blank=True,
                                                           null=True)

    fk_model = models.ForeignKey(EncryptedFKModel,
                                 blank=True,
                                 null=True,
                                 on_delete=models.CASCADE)

    objects = EncryptedModelManager()

    class Meta:
        """Sets up the meta for the test model."""
        app_label = 'tests'
class EncryptedModel(models.Model):
    """Dummy model used for tests to check the fields."""
    digest_field = fields.TextDigestField(blank=True, null=True)
    hmac_field = fields.TextHMACField(blank=True, null=True)

    email_pgp_pub_field = fields.EmailPGPPublicKeyField(blank=True, null=True)
    integer_pgp_pub_field = fields.IntegerPGPPublicKeyField(blank=True, null=True)
    pgp_pub_field = fields.TextPGPPublicKeyField(blank=True, null=True)

    email_pgp_sym_field = fields.EmailPGPSymmetricKeyField(blank=True, null=True)
    integer_pgp_sym_field = fields.IntegerPGPSymmetricKeyField(blank=True, null=True)
    pgp_sym_field = fields.TextPGPSymmetricKeyField(blank=True, null=True)
Exemple #6
0
class Person(models.Model):
    email = fields.EmailPGPSymmetricKeyField()
    salary = fields.IntegerPGPSymmetricKeyField()

    def __str__(self):
        return self.email