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) 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'
class SingleQrCode(models.Model): token = fields.TextDigestField(blank=True, default=uuid4, editable=False) user = models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING) image_name = fields.TextDigestField(blank=True, default='') url_image = fields.TextDigestField(blank=True, default='') type_qr = fields.TextDigestField(blank=True, default='') latitude = models.DecimalField(max_digits=12, decimal_places=10, blank=True, null=True, default=0.00000) longitude = models.DecimalField(max_digits=12, decimal_places=10, blank=True, null=True, default=0.00000) created = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=False) last_status_change = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=True) is_active = models.BooleanField(default=True) class Meta: app_label = 'accounts'
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'
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)
class Session(models.Model): session_token = fields.TextDigestField(blank=True, default='') session_profile = fields.CharPGPSymmetricKeyField(max_length=50, blank=True, null=True, default='') session_ip = fields.CharPGPSymmetricKeyField(max_length=50, blank=True, null=True, default='') session_setted_at = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=False) session_finished_at = fields.DateTimePGPSymmetricKeyField(default='', blank=True, null=True, editable=True) user_session = models.ForeignKey(User, null=True, blank=False, related_name="user_session", on_delete=models.SET_NULL) created = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=False) last_status_change = fields.DateTimePGPSymmetricKeyField(default=now, blank=True, editable=True) is_active = models.BooleanField(default=True) class Meta: app_label = 'accounts'
class EncryptedDiff(models.Model): CHOICES = ( ('a', 'a'), (1, '1'), ) pub_field = fields.CharPGPPublicKeyField(blank=True, null=True, choices=CHOICES, max_length=1) sym_field = fields.CharPGPSymmetricKeyField(blank=True, null=True, choices=CHOICES, max_length=1) digest_field = fields.TextDigestField(blank=True, null=True) hmac_field = fields.TextHMACField(blank=True, null=True) class Meta: """Sets up the meta for the test model.""" app_label = 'diff_keys'