예제 #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Class',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('destroyed_at', models.DateTimeField(blank=True, null=True)),
                ('name', models.CharField(max_length=200)),
                ('droplet_count', models.IntegerField(default=1)),
                ('prefix',
                 models.CharField(default=classes.models.prefix_generator,
                                  max_length=15)),
                ('droplet_image', models.CharField(max_length=50)),
                ('droplet_size', models.CharField(max_length=25)),
                ('droplet_region', models.CharField(max_length=50)),
                ('droplet_student_limit', models.IntegerField(default=1)),
                ('droplet_priv_net', models.BooleanField(default=False)),
                ('droplet_ipv6', models.BooleanField(default=False)),
                ('droplet_user_data', models.TextField(blank=True, null=True)),
            ],
        ),
    ]
예제 #2
0
class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    image = models.ImageField(default='default.jpg', upload_to='profile_pics')
    phone = models.CharField(max_length=100, blank=True, null=True)
    id_number = models.IntegerField(blank=True, null=True)
    email = models.CharField(max_length=100, blank=True, null=True)
    facebook = models.CharField(max_length=100, blank=True, null=True)
    twitter = models.CharField(max_length=100, blank=True, null=True)
    linkedin = models.CharField(max_length=100, blank=True, null=True)
    instagram = models.CharField(max_length=100, blank=True, null=True)
    timestamp = models.DateTimeField(default=timezone.now)
    is_published = models.BooleanField(default=True)

    def __str__(self):
        return f' username--> {self.user.username} ---Fullnames--> {self.user.first_name}-{self.user.last_name} '

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

        img = Image.open(self.image.path)

        if img.height > 300 or img.width > 300:
            output_size = (300, 300)
            img.thumbnail(output_size)
            img.save(self.image.path)
예제 #3
0
class Account(models.Model):
    accountname = models.ForeignKey(
        User,
        blank=True,
        null=True,
        on_delete=models.CASCADE,
    )
    fullname = models.CharField(max_length=250, blank=False, null=True)
    slug = models.SlugField(max_length=250, null=True, blank=False)
    user_class = models.CharField(max_length=100, blank=True, null=True)
    created_by = models.ForeignKey(User,
                                   on_delete=models.DO_NOTHING,
                                   related_name="created_by",
                                   blank=False,
                                   null=True)
    created_on = models.DateTimeField(default=timezone.now)
    is_published = models.BooleanField(default=True)
    is_parent = models.BooleanField(default=False)
    is_student = models.BooleanField(default=False)
    is_teacher = models.BooleanField(default=False)

    class Meta:
        ordering = ["-created_on"]

    def __str__(self):
        return self.fullname

    def get_absolute_url(self):
        return reverse('account-detail', kwargs={'slug': self.slug})
예제 #4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Account',
            fields=[
                ('account_id', models.AutoField(primary_key=True, serialize=False)),
                ('username', models.CharField(max_length=50, unique=True)),
                ('password', models.CharField(max_length=50)),
                ('first_name', models.CharField(max_length=50)),
                ('last_name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Food',
            fields=[
                ('food_id', models.AutoField(primary_key=True, serialize=False)),
                ('food_name', models.CharField(max_length=50)),
                ('picture', models.ImageField(upload_to='uploads')),
                ('price', models.FloatField(max_length=10)),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('order_id', models.AutoField(primary_key=True, serialize=False)),
                ('state', models.CharField(choices=[(classes.models.StateChoices['QUEUING'], 'Queuing'), (classes.models.StateChoices['DOING'], 'Doing'), (classes.models.StateChoices['DONE'], 'Done')], default=classes.models.StateChoices['QUEUING'], max_length=10)),
                ('total_price', models.FloatField(max_length=10)),
                ('date_time', models.DateTimeField(blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Type',
            fields=[
                ('type_id', models.AutoField(primary_key=True, serialize=False)),
                ('type_name', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('faculty', models.CharField(max_length=50)),
                ('account_account_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='classes.Account')),
            ],
        ),
        migrations.CreateModel(
            name='Owner',
            fields=[
                ('picture_owner', models.ImageField(upload_to='uploads')),
                ('account_account_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='classes.Account')),
            ],
        ),
        migrations.CreateModel(
            name='Restaurant',
            fields=[
                ('restaurant_id', models.AutoField(primary_key=True, serialize=False)),
                ('working_hours', models.TimeField(blank=True)),
                ('picture_restaurant', models.ImageField(upload_to='uploads')),
                ('restaurant_name', models.CharField(max_length=50)),
                ('type_type_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Type')),
                ('owner_account_account_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Owner')),
            ],
        ),
        migrations.CreateModel(
            name='Order_List',
            fields=[
                ('list_no', models.AutoField(primary_key=True, serialize=False)),
                ('unit', models.IntegerField()),
                ('price', models.FloatField(max_length=50)),
                ('food_food_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Food')),
                ('order_order_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Order')),
            ],
        ),
        migrations.AddField(
            model_name='food',
            name='restaurant_restaurant_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Restaurant'),
        ),
        migrations.AddField(
            model_name='order',
            name='customer_account_account_id',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='classes.Customer'),
        ),
    ]
class Migration(migrations.Migration):

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

    operations = [
        migrations.AlterField(
            model_name='account',
            name='first_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='account',
            name='last_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='account',
            name='password',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='account',
            name='username',
            field=models.CharField(blank=True,
                                   max_length=50,
                                   null=True,
                                   unique=True),
        ),
        migrations.AlterField(
            model_name='customer',
            name='account_account_id',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                primary_key=True,
                serialize=False,
                to='classes.Account'),
        ),
        migrations.AlterField(
            model_name='customer',
            name='faculty',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='food',
            name='food_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='food',
            name='picture',
            field=models.ImageField(blank=True, null=True,
                                    upload_to='uploads'),
        ),
        migrations.AlterField(
            model_name='food',
            name='price',
            field=models.FloatField(blank=True, max_length=10, null=True),
        ),
        migrations.AlterField(
            model_name='food',
            name='restaurant_restaurant_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Restaurant'),
        ),
        migrations.AlterField(
            model_name='order',
            name='customer_account_account_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Customer'),
        ),
        migrations.AlterField(
            model_name='order',
            name='date_time',
            field=models.DateTimeField(auto_now_add=True),
        ),
        migrations.AlterField(
            model_name='order',
            name='state',
            field=models.CharField(
                blank=True,
                choices=[(classes.models.StateChoices['QUEUING'], 'Queuing'),
                         (classes.models.StateChoices['DOING'], 'Doing'),
                         (classes.models.StateChoices['DONE'], 'Done')],
                default=classes.models.StateChoices['QUEUING'],
                max_length=10,
                null=True),
        ),
        migrations.AlterField(
            model_name='order',
            name='total_price',
            field=models.FloatField(blank=True, max_length=10, null=True),
        ),
        migrations.AlterField(
            model_name='order_list',
            name='food_food_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Food'),
        ),
        migrations.AlterField(
            model_name='order_list',
            name='order_order_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Order'),
        ),
        migrations.AlterField(
            model_name='order_list',
            name='price',
            field=models.FloatField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='order_list',
            name='unit',
            field=models.IntegerField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='owner',
            name='account_account_id',
            field=models.OneToOneField(
                on_delete=django.db.models.deletion.CASCADE,
                primary_key=True,
                serialize=False,
                to='classes.Account'),
        ),
        migrations.AlterField(
            model_name='owner',
            name='picture_owner',
            field=models.ImageField(blank=True, null=True,
                                    upload_to='uploads'),
        ),
        migrations.AlterField(
            model_name='restaurant',
            name='owner_account_account_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Owner'),
        ),
        migrations.AlterField(
            model_name='restaurant',
            name='picture_restaurant',
            field=models.ImageField(blank=True, null=True,
                                    upload_to='uploads'),
        ),
        migrations.AlterField(
            model_name='restaurant',
            name='restaurant_name',
            field=models.CharField(blank=True, max_length=50, null=True),
        ),
        migrations.AlterField(
            model_name='restaurant',
            name='type_type_id',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Type'),
        ),
        migrations.AlterField(
            model_name='restaurant',
            name='working_hours',
            field=models.TimeField(blank=True, null=True),
        ),
    ]
예제 #6
0
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Lessons',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('lesson_id', models.CharField(max_length=100, unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(max_length=250)),
                ('position',
                 models.PositiveSmallIntegerField(
                     verbose_name='Lecture Number')),
                ('slug', models.SlugField(blank=True, null=True)),
                ('video',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.lesson_files,
                                  verbose_name='Video')),
                ('notes',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.lesson_files,
                                  verbose_name='Notes')),
                ('ppt',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.lesson_files,
                                  verbose_name='Presentation')),
            ],
            options={
                'ordering': ['position'],
            },
        ),
        migrations.CreateModel(
            name='Semester',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
                ('slug', models.SlugField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Subjects',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('subject_id', models.CharField(max_length=100, unique=True)),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(blank=True, null=True)),
                ('image',
                 models.ImageField(blank=True,
                                   upload_to=classes.models.subject_image,
                                   verbose_name='Subject Image')),
            ],
        ),
        migrations.RemoveField(
            model_name='subject',
            name='branch',
        ),
        migrations.RemoveField(
            model_name='subject',
            name='year',
        ),
        migrations.RemoveField(
            model_name='year',
            name='branch',
        ),
        migrations.RemoveField(
            model_name='branch',
            name='description',
        ),
        migrations.DeleteModel(name='Lesson', ),
        migrations.DeleteModel(name='Subject', ),
        migrations.DeleteModel(name='Year', ),
        migrations.AddField(
            model_name='subjects',
            name='branch',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Branch'),
        ),
        migrations.AddField(
            model_name='subjects',
            name='semester',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='subjects',
                to='classes.Semester'),
        ),
        migrations.AddField(
            model_name='semester',
            name='branch',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='semester',
                to='classes.Branch'),
        ),
        migrations.AddField(
            model_name='lessons',
            name='branch',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Branch'),
        ),
        migrations.AddField(
            model_name='lessons',
            name='created_by',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='lessons',
            name='semester',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='classes.Semester'),
        ),
        migrations.AddField(
            model_name='lessons',
            name='subjects',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='lessons',
                to='classes.Subjects'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('classes', '0004_comment_reply'),
    ]

    operations = [
        migrations.CreateModel(
            name='Assignment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('assignment_id', models.CharField(max_length=100,
                                                   unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(max_length=250)),
                ('position',
                 models.PositiveSmallIntegerField(
                     verbose_name='Assignment Number')),
                ('slug', models.SlugField(blank=True, null=True)),
                ('file',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.assignment_files,
                                  verbose_name='Files')),
                ('branch',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='classes.Branch')),
                ('created_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('semester',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='classes.Semester')),
                ('subject',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='assignment',
                                   to='classes.Subject')),
            ],
        ),
        migrations.RenameField(
            model_name='reply',
            old_name='Comment_name',
            new_name='comment_name',
        ),
        migrations.CreateModel(
            name='Submission',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('submission_id', models.CharField(max_length=100,
                                                   unique=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(max_length=250)),
                ('slug', models.SlugField(blank=True, null=True)),
                ('ans_file',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.submission_files,
                                  verbose_name='Files')),
                ('assignment',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='submission',
                                   to='classes.Assignment')),
                ('created_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
예제 #8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image_file',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=classes.models.get_image_fk)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Membership',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Opinion',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('created_at', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='TheClass',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('class_name',
                 models.CharField(blank=True, max_length=120, null=True)),
                ('start_at', models.DateTimeField(blank=True, null=True)),
                ('available',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('is_done',
                 models.BooleanField(blank=True, default=False, null=True)),
                ('created_at',
                 models.DateTimeField(auto_now_add=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Video',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('video_file',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=classes.models.get_video_fk)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('belongs_to',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='videos',
                                   to='classes.TheClass')),
            ],
        ),
    ]