Esempio n. 1
0
class Beneficary(TimestampMixin):
    gender_status = models.IntegerField(
        choices=BeneficiariesGenderStatus.choices(), null=False)
    anonym_status = models.IntegerField(
        choices=BeneficiariesAnonymStatus.choices(), null=False)
    social_status = models.IntegerField(
        choices=BeneficiariesSocialStatus.choices(), null=False)
    # donation_state = models.IntegerField(choices=BeneficiariesDonationState.choices(), null=False)
    city = models.ForeignKey(City,
                             null=True,
                             blank=True,
                             default=None,
                             on_delete=models.DO_NOTHING)
    first_name = models.CharField(max_length=255, null=False)
    last_name = models.CharField(max_length=255, null=False)
    birthday = models.DateField(null=False)
    age = models.IntegerField(null=False, default=0)
    last_payment_day = models.DateTimeField(null=True,
                                            blank=True,
                                            default=None)
    payment_count = models.IntegerField(null=False, default=0)
    parents = models.TextField(null=True, blank=True, default=None)
    address = models.CharField(max_length=255, null=False)
    phone = models.CharField(max_length=255, null=False)
    characteristics = models.TextField(null=True, default=None)
    program = models.ForeignKey(Program,
                                null=False,
                                default=None,
                                on_delete=models.DO_NOTHING)

    class Meta:
        verbose_name = 'Beneficary'
        verbose_name_plural = 'Beneficaries'
Esempio n. 2
0
class Donation(TimestampMixin):
    donor = models.ForeignKey(MyUser,
                              on_delete=models.DO_NOTHING,
                              null=True,
                              default=None)
    program = models.ForeignKey(Program,
                                on_delete=models.DO_NOTHING,
                                null=False)
    beneficiaries = models.ManyToManyField(BeneficiaryAmount,
                                           related_name='beneficiaries',
                                           null=True)
    donation_amount = models.FloatField(null=True)
    certificate_amount = models.FloatField(null=True)
    donation_status = models.IntegerField(choices=DonationState.choices(),
                                          default=DonationState.PENDING.value,
                                          null=False)
    donation_anonymous_state = models.IntegerField(
        choices=DonorAnonymStatus.choices(),
        default=DonorAnonymStatus.PUBLIC.value,
        null=False)
    donation_type = models.IntegerField(choices=DonationType.choices(),
                                        default=DonationType.COMMON.value,
                                        null=False)
    guest = models.BooleanField(default=False)
    donation_automatic = models.BooleanField(default=False)

    class Meta:
        verbose_name = 'Donation'
        verbose_name_plural = 'Donations'

    def __str__(self):
        return 'donor {}, program {}, beneficiaries {}'.format(
            self.donor, self.program, self.beneficiaries)
Esempio n. 3
0
class Payment(TimestampMixin):
    order_id = models.CharField(max_length=100,
                                blank=True,
                                unique=True,
                                default=uuid.uuid4,
                                editable=False,
                                primary_key=True)
    amount = models.FloatField(default=0, null=False)
    donation = models.OneToOneField(Donation,
                                    on_delete=models.DO_NOTHING,
                                    null=True)
    title = models.CharField(max_length=255,
                             null=True,
                             default="Пожертвование")
    payment_description = models.CharField(default='Пожертвование',
                                           max_length=255)
    payment_url = models.TextField(null=True, default=' ')
    payment_result_url = models.TextField(null=True, default=' ')
    payment_id_paybox = models.CharField(default='0', max_length=255)
    payment_status = models.IntegerField(
        choices=PaymentStatus.choices(),
        null=False,
        default=PaymentStatus.CREATED_PAYMENT.value)
    payment_paybox_result = models.CharField(max_length=255,
                                             default="none",
                                             null=True)
    payment_date = models.CharField(max_length=255, default="", null=True)
    payment_signature = models.CharField(max_length=255, default="", null=True)

    class Meta:
        verbose_name = 'Payment'
        verbose_name_plural = 'Payments'
Esempio n. 4
0
class DonorRecurringProfile(TimestampMixin):
    donor = models.ForeignKey(MyUser, on_delete=models.DO_NOTHING)
    recurring_period = models.IntegerField(
        choices=DonorRecurringPeriod.choices(), null=False)
    recurring_profile_id = models.IntegerField(null=False)
    amount = models.IntegerField(null=False)
    recurring_period_expire_date = models.CharField(max_length=255,
                                                    default=None)
    active_status = models.IntegerField(null=False)
    in_processing = models.IntegerField(default=None)
    last_transaction = models.TimeField(null=True, default=None)
    next_transaction = models.TimeField(null=True, default=None)

    class Meta:
        verbose_name = 'Donor recurring profile'
        verbose_name_plural = 'Donor recurring profiles'
Esempio n. 5
0
class Gift(TimestampMixin):
    partner_program = models.ForeignKey(PartnerProgram,
                                        null=True,
                                        on_delete=models.DO_NOTHING)
    beneficiary = models.ForeignKey(Beneficary, on_delete=models.DO_NOTHING)
    gift_counts = models.IntegerField(null=True)
    comment = models.TextField(null=False)
    gift_image = models.ImageField(upload_to='gift_images', null=True)

    class Meta:
        verbose_name = 'Gift'
        verbose_name_plural = 'Gifts'
Esempio n. 6
0
class Certificate(TimestampMixin):
    beneficiary = models.ForeignKey(Beneficary, on_delete=models.DO_NOTHING)
    program = models.CharField(max_length=255, null=True)
    amount = models.FloatField(null=True)
    partner_program = models.ForeignKey(PartnerProgram,
                                        on_delete=models.DO_NOTHING,
                                        null=True)
    donation = models.ForeignKey(Donation, on_delete=models.DO_NOTHING)
    issued_state = models.IntegerField(choices=IssueState.choices(),
                                       default=IssueState.CREATED.value)
    # issued_by = models.ForeignKey(MyUser, on_delete=models.DO_NOTHING)
    # donor_anonymous_status = models.IntegerField(choices=DonorAnonymStatus.choices(),
    #                                              default=DonorAnonymStatus.PUBLIC.value)
    comment = models.TextField(null=True)

    # issue_date = models.DateField(auto_now_add=True)

    class Meta:
        verbose_name = 'Certificate'
        verbose_name_plural = 'Certificates'
Esempio n. 7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('utility', '0001_initial'),
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Время создания')),
                ('updated_at',
                 models.DateTimeField(
                     auto_now=True,
                     verbose_name='Время последнего изменения')),
                ('username', models.CharField(max_length=255, unique=True)),
                ('first_name', models.CharField(max_length=255, null=True)),
                ('second_name', models.CharField(max_length=255, null=True)),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('role',
                 models.IntegerField(choices=[(1, 'ADMIN'), (2, 'MANAGER'),
                                              (3, 'USER'),
                                              (4, 'MANAGER_REGION'),
                                              (5, 'PARTNER')],
                                     default=3)),
                ('is_active', models.BooleanField(default=True)),
                ('is_superuser', models.BooleanField(default=False)),
                ('is_staff', models.BooleanField(default=False)),
                ('join_date', models.DateTimeField(auto_now=True)),
                ('pay_zakyat', models.BooleanField(default=False)),
                ('city',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to='utility.City')),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', app.users.models.MyUserManager()),
            ],
        ),
        migrations.CreateModel(
            name='PasswordResets',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Время создания')),
                ('updated_at',
                 models.DateTimeField(
                     auto_now=True,
                     verbose_name='Время последнего изменения')),
                ('email', models.CharField(max_length=255)),
                ('code', models.CharField(max_length=255)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Password reset',
                'verbose_name_plural': 'Password resets',
            },
        ),
        migrations.CreateModel(
            name='Partner',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Время создания')),
                ('updated_at',
                 models.DateTimeField(
                     auto_now=True,
                     verbose_name='Время последнего изменения')),
                ('title', models.CharField(max_length=255)),
                ('description', models.CharField(max_length=255)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Partner',
                'verbose_name_plural': 'Partners',
            },
        ),
    ]
Esempio n. 8
0
class DefaultDonationAmount(TimestampMixin):
    sum = models.IntegerField(null=False)

    class Meta:
        verbose_name = 'Default donation denominations'
        verbose_name_plural = 'Default donation denominations'