Пример #1
0
class ShoppingCartItems(models.Model):
    product = models.ForeignKey('Product', null=True)
    user = models.ForeignKey('account.FomoUser', null=True)
    quantity = models.IntegerField(default=0, null=True)
    extended_amount = models.DecimalField(max_digits=6,
                                          decimal_places=2,
                                          null=True)
Пример #2
0
class SaleItems(models.Model):
    product = models.ForeignKey('Product', null=True)
    sale = models.ForeignKey('Sales', null=True)
    quantity_purchased = models.IntegerField(null=True, blank=False)
    sale_price = models.DecimalField(max_digits=6, decimal_places=2)
    tax = models.DecimalField(max_digits=6, decimal_places=2)
    shipping_cost = models.DecimalField(max_digits=6, decimal_places=2)

    @staticmethod
    def calc_subtotal():
        cartItems = ShoppingCartItems.objects.all()

        subtotal = 0
        for s in cartItems:
            subtotal += s.extended_amount

        return subtotal

    @staticmethod
    def calc_tax():
        tax = round(SaleItems.calc_subtotal() * Decimal(0.0725), 2)
        return tax

    @staticmethod
    def calc_total():
        total = (SaleItems.calc_subtotal() + SaleItems.calc_tax() + 10)
        return total

    @staticmethod
    def clear_cart(user):
        product = ShoppingCartItems.objects.filter(user=user)
        for p in product:
            p.delete()
Пример #3
0
class Migration(migrations.Migration):
    dependencies = [
        ('account', '0003_auto_20190328_2144'),
    ]

    operations = [
        migrations.CreateModel(
            name='Trophy',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='作成日')),
                ('updated_at',
                 models.DateTimeField(auto_now=True, verbose_name='更新日')),
                ('title', models.CharField(max_length=255, unique=True)),
                ('description', models.CharField(max_length=255)),
                ('file',
                 models.FileField(upload_to=account.models.trophy_upload_to)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='TrophyUserRelation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='作成日')),
                ('updated_at',
                 models.DateTimeField(auto_now=True, verbose_name='更新日')),
                ('trophy',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='account.Trophy')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
Пример #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('account', '0006_user_phone'),
    ]

    operations = [
        migrations.CreateModel(
            name='SmsCode',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('code',
                 models.PositiveSmallIntegerField(
                     default=account.models.generate_sms_code)),
                ('is_activated', models.BooleanField(default=False)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='sms_codes',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #5
0
class Migration(migrations.Migration):

    dependencies = [
        ('account', '0022_auto_20200223_1506'),
    ]

    operations = [
        migrations.CreateModel(
            name='UpcomingTest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('date', models.DateField()),
                ('description',
                 models.TextField(blank=True, max_length=250, null=True)),
                ('topics',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=account.models.Event.test_pdf_upload_path)),
                ('sub_class',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='account.SubClass')),
            ],
        ),
    ]
Пример #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id',
                 models.BigAutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name='ID')),
                ('date_of_birth', models.DateField(blank=True, null=True)),
                ('photo',
                 models.ImageField(
                     blank=True,
                     upload_to=account.models.user_directory_path)),
                ('user',
                 models.ForeignKey(blank=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #7
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='ResetPassword',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('transaction',
                 models.UUIDField(
                     default=account.models.ResetPassword.transaction_default)
                 ),
                ('token',
                 models.CharField(default=account.models.token_default,
                                  max_length=68)),
                ('expire_date',
                 models.DateTimeField(
                     db_index=True,
                     default=account.models.ResetPassword.expire_date_default)
                 ),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('phone_num',
                 models.CharField(blank=True, max_length=11, null=True)),
                ('sex',
                 models.CharField(choices=[(1, '男'), (2, '女')],
                                  default=1,
                                  max_length=2)),
                ('picture',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=account.models.upload_to)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('saldo',
                 models.DecimalField(
                     decimal_places=2,
                     max_digits=10,
                     validators=[
                         django.core.validators.MinValueValidator(0.0)
                     ])),
                ('accountNumber',
                 models.CharField(
                     default=account.models.Account.accountGenerator,
                     max_length=12,
                     unique=True)),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Plan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=128, verbose_name='title')),
                ('description', models.TextField(blank=True, verbose_name='description')),
                ('total_bandwidth', models.BigIntegerField(default=0, verbose_name='total_bandwidth')),
            ],
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('amount_consumed_down', models.BigIntegerField(default=0, verbose_name='amount_consumed_down')),
                ('amount_consumed_up', models.BigIntegerField(default=0, verbose_name='amount_consumed_up')),
                ('active_plan', models.ForeignKey(default=account.models.get_sentinel_plan, on_delete=models.SET(account.models.get_sentinel_plan), to='account.Plan')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('resume',
                 models.FileField(upload_to='resumes/',
                                  verbose_name='Upload Resumes')),
                ('image',
                 models.ImageField(blank=True,
                                   upload_to=account.models.upload_location,
                                   verbose_name='image')),
                ('phonenumber', models.CharField(blank=True, max_length=50)),
                ('address', models.CharField(blank=True, max_length=50)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #12
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('account', '0001_initial'),
        ('post', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Photo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('id_photo', models.IntegerField(null=True, unique=True)),
                ('photo', models.ImageField(blank=True, default='defult-photo.png', null=True, upload_to=account.models.user_directory_path)),
                ('like_put', models.BooleanField(default=False, null=True)),
                ('account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='images', to='account.Account')),
                ('post', models.ManyToManyField(blank=True, related_name='images', to='post.Post')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
    ]
Пример #13
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('quiz', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserChoice',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('choice_text', models.CharField(max_length=300)),
                ('question',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='quiz.Question')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('mark', models.IntegerField(default=0)),
                ('test_date', models.DateTimeField(auto_now_add=True)),
                ('current_question',
                 models.IntegerField(
                     default=account.models.get_first_question)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #14
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('nick_name', models.CharField(blank=True, max_length=50)),
                ('phone_number',
                 models.CharField(
                     blank=True,
                     max_length=10,
                     validators=[
                         django.core.validators.RegexValidator(
                             message=
                             "Phone number must be entered in the format:'+999999999'.Up to 15 digits allowed.",
                             regex='^\\+?1?\\d{9,15}$')
                     ])),
                ('image',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=account.models.user_directory_path)),
                ('has_picture', models.BooleanField(default=False)),
                ('father_name', models.CharField(blank=True, max_length=50)),
                ('whatsapp_no',
                 models.CharField(
                     blank=True,
                     max_length=10,
                     validators=[
                         django.core.validators.RegexValidator(
                             message=
                             "Phone number must be entered in the format:'+999999999'.Up to 15 digits allowed.",
                             regex='^\\+?1?\\d{9,15}$')
                     ])),
                ('fb_id', models.CharField(blank=True, max_length=50)),
                ('current_address', models.CharField(blank=True,
                                                     max_length=250)),
                ('is_active', models.BooleanField(default=True)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #15
0
class Product(PolymorphicModel):
    #id
    price = models.DecimalField(max_digits=8,
                                decimal_places=2,
                                blank=True,
                                null=True)  #999,999.99
    name = models.TextField(blank=True, null=True)
    brand = models.TextField(blank=True, null=True)
    category = models.ForeignKey('Category')
    create_date = models.DateTimeField(auto_now_add=True)
    modified_date = models.DateTimeField(auto_now=True)
    path = models.TextField(blank=True, null=True)
    desc = models.TextField(blank=True, null=True)
Пример #16
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('photo', models.ImageField(editable=False, upload_to=account.models.image_file_path)),
                ('text', models.TextField(blank=True, max_length=500)),
                ('location', models.CharField(blank=True, max_length=30)),
                ('posted_on', models.DateTimeField(auto_now_add=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_posts', to=settings.AUTH_USER_MODEL)),
                ('likes', models.ManyToManyField(blank=True, related_name='likers', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-posted_on'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.CharField(max_length=100)),
                ('posted_on', models.DateTimeField(auto_now_add=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_comments', to=settings.AUTH_USER_MODEL)),
                ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='post_comments', to='main.post')),
            ],
            options={
                'ordering': ['-posted_on'],
            },
        ),
    ]
Пример #17
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True, db_index=True)),
                ('user_from', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rel_from_set', to=settings.AUTH_USER_MODEL)),
                ('user_to', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rel_to_set', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-created',),
            },
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=32)),
                ('signature', models.CharField(blank=True, max_length=255, null=True)),
                ('avatar', models.ImageField(blank=True, null=True, upload_to=account.models.UserProfile.get_upload_path)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created'],
                'abstract': False,
            },
        ),
    ]
Пример #18
0
class Migration(migrations.Migration):

    dependencies = [
        ('account', '0040_auto_20200316_1154'),
    ]

    operations = [
        migrations.CreateModel(
            name='Archive',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.TextField(max_length=100)),
                ('text', models.TextField(max_length=1000)),
                ('date_added', models.DateField(auto_now_add=True)),
                ('archive_type',
                 models.CharField(choices=[('submission', 'Submission'),
                                           ('private', 'Private')],
                                  default='private',
                                  max_length=30)),
                ('pdf',
                 models.FileField(
                     blank=True,
                     null=True,
                     upload_to=account.models.Archive.pdf_upload_archive_path)
                 ),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='account.Userprofile')),
                ('sub_class',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='account.SubClass')),
            ],
        ),
    ]
Пример #19
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Notification',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='Notifictation text')),
                ('seen', models.BooleanField(verbose_name='Seen')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='StudentField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('student_id', models.IntegerField()),
                ('avatar', models.ImageField(default='/avatars/default.jpg', upload_to=account.models.handle_avatar_upload_path)),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.StudentField')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #20
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            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')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
                ('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',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Avatar',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file_path', models.FileField(upload_to=account.models.user_avatar_upload)),
                ('active_avatar', models.BooleanField(null=True)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('user', 'active_avatar')},
            },
        ),
    ]
Пример #21
0
class Sales(models.Model):
    user = models.ForeignKey('account.FomoUser', null=True)
    date = models.DateTimeField(auto_now=True, null=True)
    shipping_address = models.TextField(blank=False, null=False)
    total_cost = models.DecimalField(max_digits=6, decimal_places=2)

    @staticmethod
    def record_sale(user, cart_items, address, stripe_token, sale_id):

        sale = Sales()
        sale.user = user
        sale.shipping_address = address

        sale.total_cost = SaleItems.calc_total()

        sale.save()

        saleItem = SaleItems()
        for s in cart_items:
            saleItem.product = s.product
            saleItem.sale = sale
            saleItem.quantity_purchased = s.quantity
            saleItem.sale_price = s.product.price
            saleItem.tax = round(s.product.price * Decimal(.075), 2)
            saleItem.shipping_cost = 10

            saleItem.save()

        payment = Payment()
        payment.sale = sale
        payment.stripe_token = stripe_token
        payment.amount = sale.total_cost
        payment.save()

        for s in cart_items:
            product = Product.objects.get(id=s.product.id)
            if hasattr(s.product, 'quantity'):
                product.quantity -= s.quantity
            elif hasattr(s.product, 'active'):
                product.active = False

            product.save()

        sale_id['value'] = sale.id
Пример #22
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
        ('membership', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            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')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('membership_start_date', models.DateTimeField(blank=True, null=True)),
                ('membership_end_date', models.DateTimeField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=False)),
                ('verify_code', models.CharField(blank=True, editable=False, help_text='Account verification code', max_length=512, null=True)),
                ('verify_time_limit', models.DateTimeField(blank=True, editable=False, null=True)),
                ('reset_code', models.CharField(blank=True, editable=False, help_text='Account verification code', max_length=512, null=True)),
                ('reset_time_limit', models.DateTimeField(blank=True, editable=False, null=True)),
                ('created_on', models.DateTimeField(auto_now=True)),
                ('updated_on', models.DateTimeField(auto_now_add=True)),
                ('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')),
                ('user_type', models.ForeignKey(default='Basic', on_delete=django.db.models.deletion.PROTECT, to='membership.Membership')),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', account.models.UserManager()),
            ],
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.AlterModelManagers(
            name='user',
            managers=[
                ('objects', account.models.UserManage()),
            ],
        ),
        migrations.CreateModel(
            name='Token',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='create time')),
                ('expired',
                 models.DateTimeField(
                     default=account.models._default_expire_time,
                     verbose_name='token expire time')),
                ('token', models.TextField(blank=True, verbose_name='token')),
                ('user',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='tokens',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='User')),
            ],
            options={
                'verbose_name': 'Token',
                'verbose_name_plural': 'Tokens',
                'ordering': ('user', ),
            },
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            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')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
                ('first_name', models.CharField(blank=True, default='', max_length=255, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, default='', max_length=255, verbose_name='last name')),
                ('date_joined', models.DateTimeField(default=utils.dates.utcnow, verbose_name='date joined')),
                ('is_active', models.BooleanField(default=True, verbose_name='active')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('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', account.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='OutlookUser',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('unique_identifier', models.TextField()),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #25
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('account', '0003_bank_description'),
    ]

    operations = [
        migrations.AlterField(
            model_name='bank',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AlterField(
            model_name='profile',
            name='photo',
            field=models.ImageField(
                blank=True, upload_to=account.models.get_directory_path),
        ),
    ]
Пример #26
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Photos',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('photo',
                 models.ImageField(upload_to=account.models.customPath)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #27
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('account', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image', models.ImageField(upload_to=account.models.url)),
                ('up_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='account.Profile')),
            ],
        ),
    ]
Пример #28
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='WorkPlace',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='AccountUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('first_name', models.CharField(max_length=30)),
                ('last_name', models.CharField(max_length=30)),
                ('username', models.CharField(max_length=30)),
                ('email', models.EmailField(max_length=30, unique=True)),
                ('date_joined',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='date joined')),
                ('last_login',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last login')),
                ('is_active', models.BooleanField(default=True)),
                ('is_admin', models.BooleanField(default=False)),
                ('is_staff', models.BooleanField(default=False)),
                ('is_user', models.BooleanField(default=False)),
                ('is_superuser', models.BooleanField(default=False)),
                ('role',
                 models.CharField(blank=True,
                                  choices=[('US', 'User'),
                                           ('PR', 'Project Manager'),
                                           ('QA', 'Quality Analyst')],
                                  default='US',
                                  max_length=100,
                                  null=True)),
                ('workplace_id',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='account.WorkPlace')),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', account.models.MyAccountUserManager()),
            ],
        ),
    ]
Пример #29
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('email',
                 models.EmailField(max_length=60,
                                   unique=True,
                                   verbose_name='email')),
                ('name', models.CharField(max_length=50, verbose_name='name')),
                ('date_joined',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='date joined')),
                ('last_login',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last login')),
                ('is_admin', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('is_staff', models.BooleanField(default=False)),
                ('is_superuser', models.BooleanField(default=False)),
                ('is_recruitment_applicant',
                 models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
            managers=[
                ('objects', account.models.MyAccountManager()),
            ],
        ),
        migrations.CreateModel(
            name='RecruitmentApplicant',
            fields=[
                ('name', models.CharField(max_length=50, verbose_name='name')),
                ('roll_number',
                 models.CharField(max_length=10,
                                  primary_key=True,
                                  serialize=False)),
                ('batch',
                 models.CharField(choices=[('firstYear', 'First Year'),
                                           ('secondYear', 'Second Year'),
                                           ('thirdYear', 'Third Year'),
                                           ('fourthYear', 'Final Year'),
                                           ('PostGraduate', 'PG')],
                                  max_length=20)),
                ('branch',
                 models.CharField(choices=[
                     ('CSE', 'Computer Science'),
                     ('IT', 'Information Technology'),
                     ('ECE', 'Electronics and Communication'),
                     ('EEE', 'Electronics and Electrical'),
                     ('MECH', 'Mechanical'), ('CV', 'Civil'),
                     ('CH', 'Chemical'), ('META', 'Metallurgy and Materials')
                 ],
                                  max_length=20)),
                ('status',
                 models.CharField(choices=[('written', 'Written Test'),
                                           ('interview',
                                            'Selected for Interview'),
                                           ('selected', 'Selected')],
                                  default='written',
                                  max_length=20)),
                ('phoneNumber',
                 models.CharField(
                     blank=True,
                     max_length=17,
                     validators=[
                         django.core.validators.RegexValidator(
                             message='Incorrect phone number format',
                             regex=
                             '^(?:(?:\\+|0{0,2})91(\\s*[\\-]\\s*)?|[0]?)?[789]\\d{9}$'
                         )
                     ])),
                ('email',
                 models.EmailField(max_length=60,
                                   unique=True,
                                   verbose_name='email')),
                ('recruitmentYear', models.CharField(default=2020,
                                                     max_length=4)),
                ('applicant',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='applicant',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Пример #30
0
class Migration(migrations.Migration):

    dependencies = [
        ('socle', '0006_auto_20211006_2229'),
        ('account', '0017_auto_20220328_0857'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='adhesion',
            name='children',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='chrono',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='date_end',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='date_start',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='file',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='levels',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='students',
        ),
        migrations.RemoveField(
            model_name='adhesion',
            name='user',
        ),
        migrations.AddField(
            model_name='adhesion',
            name='level',
            field=models.ForeignKey(
                blank=True,
                editable=False,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='adhesions',
                to='socle.Level'),
        ),
        migrations.AddField(
            model_name='adhesion',
            name='start',
            field=models.DateTimeField(blank=True, editable=False, null=True),
        ),
        migrations.AddField(
            model_name='adhesion',
            name='stop',
            field=models.DateTimeField(blank=True, editable=False, null=True),
        ),
        migrations.AddField(
            model_name='adhesion',
            name='student',
            field=models.ForeignKey(
                blank=True,
                editable=False,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='adhesions',
                to='account.Student'),
        ),
        migrations.AlterField(
            model_name='adhesion',
            name='amount',
            field=models.DecimalField(decimal_places=2,
                                      editable=False,
                                      max_digits=6,
                                      verbose_name='Montant'),
        ),
        migrations.CreateModel(
            name='Facture',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('chrono',
                 models.CharField(editable=False,
                                  max_length=50,
                                  verbose_name='Chrono')),
                ('file',
                 models.FileField(blank=True,
                                  default='',
                                  editable=False,
                                  null=True,
                                  upload_to=account.models.file_directory_path,
                                  verbose_name='fichier')),
                ('chro',
                 models.CharField(blank=True,
                                  editable=False,
                                  max_length=50,
                                  null=True,
                                  verbose_name='Chrono')),
                ('adhesions',
                 models.ManyToManyField(blank=True,
                                        editable=False,
                                        related_name='factures',
                                        to='account.Adhesion')),
                ('user',
                 models.ForeignKey(blank=True,
                                   editable=False,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='factures',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]