Esempio n. 1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='CustomUser',
            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=255,
                                   unique=True,
                                   verbose_name='email address')),
                ('phone',
                 models.CharField(error_messages={'error': 'Wacha games'},
                                  max_length=10,
                                  unique=True,
                                  verbose_name='Safaricom MPESA Number')),
                ('id_kenya',
                 models.CharField(max_length=8,
                                  unique=True,
                                  verbose_name='Kenya ID Number')),
                ('kra_pin',
                 models.CharField(max_length=20,
                                  unique=True,
                                  verbose_name='KRA PIN')),
                ('first_name', models.CharField(max_length=15)),
                ('middle_name', models.CharField(blank=True, max_length=15)),
                ('last_name', models.CharField(max_length=15)),
                ('dob',
                 models.DateField(verbose_name='Date-Of-Birth YYYY/dd/mm')),
                ('nok_name',
                 models.CharField(max_length=20,
                                  verbose_name='Next of Kin Full Name')),
                ('nok_phone',
                 models.CharField(
                     max_length=10,
                     verbose_name='Next of Kin Safaricom MPESA Mobile Number')
                 ),
                ('comments', models.TextField(blank=True, max_length=100)),
                ('gender',
                 models.CharField(choices=[('MALE', 'Male'),
                                           ('FEMALE', 'Female')],
                                  default='MALE',
                                  max_length=6,
                                  verbose_name='Gender')),
                ('is_staff', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=True)),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('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={
                'abstract': False,
            },
        ),
    ]
class User(models.Model):
    """
        This Database stores the User Information.
        The comments on the side refer to the
        CAS login creds for reference.
    """

    def __str__(self):
        return "    ".join([str(self.user_nick), str(self.user_username)])

    user_username = models.CharField(
        max_length = 255,
    ) # returned by CAS::getUser(), normally equal to mail.
    user_email = models.EmailField(
        max_length=255,
        unique=True
    ) #mail
    user_nick = models.CharField(
        max_length=255,
    ) # displayName
    user_last_ip = models.GenericIPAddressField(
        editable = True,
        default = '0.0.0.0',
    )

    # This is the highest level of questions that one can access.
    user_access_level = models.IntegerField(
        default = 1,
        editable = True,
    )
   
    user_score = models.FloatField(
        default = 0,
        editable = True,
    )

    def level_up(self):
        """
           Increments User level. Call with care.
        """
        self.user_access_level += 1

    def score_up(self, increment_by):
        """
           Score Up by parameter increment_by
        """
        self.user_score += increment_by

    def counter_inc(self, level):
        """
            Cheap hack to increment user_access level states.
        """

        if level == 1:
            self.user_level_1 += 1
            return self.user_level_1
        elif level == 2:
            self.user_level_2 += 1
            return self.user_level_2
        elif level == 3:
            self.user_level_3 += 1
            return self.user_level_3
        elif level == 4:
            self.user_level_4 += 1
            return self.user_level_4
        elif level == 5:
            self.user_level_5 += 1
            return self.user_level_5
        elif level == 6:
            self.user_level_6 += 1
            return self.user_level_6
        elif level == 7:
            self.user_level_7 += 1
            return self.user_level_7
        elif level == 8:
            self.user_level_8 += 1
            return self.user_level_8
        elif level == 9:
            self.user_level_9 += 1
            return self.user_level_9
        elif level == 10:
            self.user_level_10 += 1
            return self.user_level_10
        elif level == 11:
            self.user_level_11 += 1
            return self.user_level_11
        elif level == 12:
            self.user_level_12 += 1
            return self.user_level_12
        elif level == 13:
            self.user_level_13 += 1
            return self.user_level_13
        elif level == 14:
            self.user_level_14 += 1
            return self.user_level_14
        elif level == 15:
            self.user_level_15 += 1
            return self.user_level_15
        elif level == 16:
            self.user_level_16 += 1
            return self.user_level_16
        elif level == 17:
            self.user_level_17 += 1
            return self.user_level_17
        elif level == 18:
            self.user_level_18 += 1
            return self.user_level_18
        elif level == 19:
            self.user_level_19 += 1
            return self.user_level_19
        elif level == 20:
            self.user_level_20 += 1
            return self.user_level_20
        elif level == 21:
            self.user_level_21 += 1
            return self.user_level_21
        elif level == 22:
            self.user_level_22 += 1
            return self.user_level_22
        elif level == 23:
            self.user_level_23 += 1
            return self.user_level_23
        elif level == 24:
            self.user_level_24 += 1
            return self.user_level_24
        elif level == 25:
            self.user_level_25 += 1
            return self.user_level_25
        elif level == 26:
            self.user_level_26 += 1
            return self.user_level_26
        elif level == 27:
            self.user_level_27 += 1
            return self.user_level_27
        elif level == 28:
            self.user_level_28 += 1
            return self.user_level_28
        elif level == 29:
            self.user_level_29 += 1
            return self.user_level_29
        elif level == 30:
            self.user_level_30 += 1
            return self.user_level_30

    # flash message
    user_notification_flash = models.BooleanField(
        default = False,
    )

    user_level_1 = models.IntegerField(
        default = 0,
    )

    user_level_2 = models.IntegerField(
        default = 0,
    )

    user_level_3 = models.IntegerField(
        default = 0,
    )

    user_level_4 = models.IntegerField(
        default = 0,
    )

    user_level_5 = models.IntegerField(
        default = 0,
    )

    user_level_6 = models.IntegerField(
        default = 0,
    )

    user_level_7 = models.IntegerField(
        default = 0,
    )

    user_level_8 = models.IntegerField(
        default = 0,
    )

    user_level_9 = models.IntegerField(
        default = 0,
    )

    user_level_10 = models.IntegerField(
        default = 0,
    
        )
    user_level_11 = models.IntegerField(
        default = 0,
    )

    user_level_12 = models.IntegerField(
        default = 0,
    )

    user_level_13 = models.IntegerField(
        default = 0,
    )

    user_level_14 = models.IntegerField(
        default = 0,
    )

    user_level_15 = models.IntegerField(
        default = 0,
    )

    user_level_16 = models.IntegerField(
        default = 0,
    )

    user_level_17 = models.IntegerField(
        default = 0,
    )

    user_level_18 = models.IntegerField(
        default = 0,
    )

    user_level_19 = models.IntegerField(
        default = 0,
    )

    user_level_20 = models.IntegerField(
        default = 0,
    )

    user_level_21 = models.IntegerField(
        default = 0,
    )

    user_level_22 = models.IntegerField(
        default = 0,
    )

    user_level_23 = models.IntegerField(
        default = 0,
    )

    user_level_24 = models.IntegerField(
        default = 0,
    )

    user_level_25 = models.IntegerField(
        default = 0,
    )

    user_level_26 = models.IntegerField(
        default = 0,
    )

    user_level_27 = models.IntegerField(
        default = 0,
    )

    user_level_28 = models.IntegerField(
        default = 0,
    )

    user_level_29 = models.IntegerField(
        default = 0,
    )

    user_level_30 = models.IntegerField(
        default = 0,
    )
Esempio n. 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_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=255,
                                   unique=True,
                                   verbose_name='email address')),
                ('first_name',
                 models.CharField(max_length=50, verbose_name='first name')),
                ('last_name',
                 models.CharField(max_length=50, verbose_name='last name')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into the 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 users.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('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={
                'ordering': ['email'],
                'swappable': 'AUTH_USER_MODEL',
            },
        ),
    ]
Esempio n. 4
0
class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0006_require_contenttypes_0002'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(null=True, blank=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')),
                ('userid', models.CharField(verbose_name='user_id', max_length=255, unique=True)),
                ('date_of_birth', models.DateField(default=datetime.datetime(2016, 5, 31, 17, 28, 32, 387799, tzinfo=utc))),
                ('is_active', models.BooleanField(default=True)),
                ('is_admin', models.BooleanField(default=False)),
                ('groups', models.ManyToManyField(blank=True, related_name='user_set', to='auth.Group', help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_query_name='user', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, related_name='user_set', to='auth.Permission', help_text='Specific permissions for this user.', related_query_name='user', verbose_name='user permissions')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Banks',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(default='', max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Branch',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('title', models.CharField(default='', max_length=20)),
                ('name', models.CharField(default='', max_length=100)),
                ('roll_code', models.CharField(default='', max_length=5)),
            ],
        ),
        migrations.CreateModel(
            name='ChiefWarden',
            fields=[
                ('username', models.CharField(max_length=20, serialize=False, primary_key=True, default='')),
                ('name', models.CharField(default='', max_length=20)),
                ('email', models.EmailField(max_length=254)),
                ('mobno', models.CharField(max_length=15)),
                ('phoneno', models.CharField(max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Closures',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField()),
                ('clo_or_ext', models.BooleanField()),
            ],
        ),
        migrations.CreateModel(
            name='Complaints',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('lodgers_roll_no', models.CharField(max_length=300)),
                ('description', models.CharField(default='', max_length=300)),
                ('date_of_complaint', models.DateField(auto_now=True)),
                ('closed', models.BooleanField(default=False)),
                ('forwarded', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='CriminalRecord',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('description', models.CharField(max_length=400)),
                ('fine_amount', models.IntegerField()),
                ('paid', models.BooleanField(default=False)),
                ('date_of_action', models.DateField()),
                ('file', models.FileField(upload_to=newapp.models.CriminalRecordFile)),
            ],
        ),
        migrations.CreateModel(
            name='Event',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('title', models.CharField(default='', max_length=100, unique=True)),
                ('description', models.TextField(default='', max_length=1000)),
                ('time', models.DateTimeField(default=datetime.datetime(2016, 5, 31, 17, 28, 32, 403888, tzinfo=utc))),
            ],
        ),
        migrations.CreateModel(
            name='Facilities',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('facility_name', models.CharField(default='', max_length=100)),
                ('facility_description', models.TextField(default='')),
                ('photo', models.ImageField(null=True, upload_to=newapp.models.facility_photo_name, blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Form',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('title', models.CharField(default='', max_length=200)),
                ('time', models.DateTimeField(auto_now_add=True)),
                ('file', models.FileField(upload_to=newapp.models.form_file_name)),
            ],
        ),
        migrations.CreateModel(
            name='HostelAttachDates',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('hostel_last_date', models.DateField(default=datetime.datetime.now)),
            ],
        ),
        migrations.CreateModel(
            name='HostelCouncil',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('name', models.CharField(default='', max_length=100)),
                ('email', models.EmailField(max_length=254)),
                ('phone', models.CharField(default='', max_length=15)),
                ('position', models.CharField(default='', max_length=100)),
                ('committee', models.CharField(null=True, default='', blank=True, max_length=100)),
                ('photo', models.ImageField(null=True, upload_to=newapp.models.council_photo_name, blank=True)),
            ],
        ),
        migrations.CreateModel(
            name='Hostels',
            fields=[
                ('username', models.CharField(max_length=20, serialize=False, primary_key=True, default='')),
                ('name', models.CharField(null=True, default='', max_length=50)),
                ('hostel_name', models.CharField(default='', max_length=20)),
                ('semEndDate', models.DateField(null=True, default=datetime.date(2016, 5, 31))),
                ('room_capacity', models.IntegerField(null=True, blank=True)),
                ('room_available', models.IntegerField(null=True, blank=True)),
                ('phone', models.CharField(null=True, blank=True, max_length=20)),
                ('email', models.EmailField(null=True, blank=True, max_length=254)),
                ('landline', models.CharField(null=True, blank=True, max_length=300)),
                ('portfolio', models.CharField(null=True, blank=True, max_length=40)),
                ('department', models.CharField(null=True, blank=True, max_length=20)),
                ('warden_photo', models.ImageField(null=True, upload_to=newapp.models.warden_photo_name, blank=True)),
                ('hostel_photo', models.ImageField(null=True, upload_to=newapp.models.main_page_photo_name, blank=True)),
                ('hostel_text', models.CharField(default='', max_length=100)),
                ('chief_warden', models.ForeignKey(to='newapp.ChiefWarden')),
            ],
        ),
        migrations.CreateModel(
            name='Images',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('image', models.ImageField(upload_to=newapp.models.eventphotoname)),
                ('event', models.ForeignKey(default=None, to='newapp.Event')),
            ],
        ),
        migrations.CreateModel(
            name='MedicalHistory',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('description', models.CharField(max_length=250)),
            ],
        ),
        migrations.CreateModel(
            name='MessDetail',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('weekday_breakfast_from', models.TimeField()),
                ('weekday_breakfast_to', models.TimeField()),
                ('weekday_lunch_from', models.TimeField()),
                ('weekday_lunch_to', models.TimeField()),
                ('weekday_snack_from', models.TimeField()),
                ('weekday_snack_to', models.TimeField()),
                ('weekday_dinner_from', models.TimeField()),
                ('weekday_dinner_to', models.TimeField()),
                ('weekend_breakfast_from', models.TimeField()),
                ('weekend_breakfast_to', models.TimeField()),
                ('weekend_lunch_from', models.TimeField()),
                ('weekend_lunch_to', models.TimeField()),
                ('weekend_snack_from', models.TimeField()),
                ('weekend_snack_to', models.TimeField()),
                ('weekend_dinner_from', models.TimeField()),
                ('weekend_dinner_to', models.TimeField()),
                ('menu', models.FileField(upload_to=newapp.models.messmenu_file_name)),
                ('hostel', models.ForeignKey(to='newapp.Hostels')),
            ],
        ),
        migrations.CreateModel(
            name='Notice',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('title', models.CharField(default=None, max_length=200, unique=True)),
                ('file', models.FileField(null=True, upload_to=newapp.models.noticePhotoForm)),
                ('creator', models.CharField(max_length=30)),
                ('date', models.DateField(default=datetime.date(2016, 5, 31))),
                ('active', models.BooleanField(default=True)),
            ],
        ),
        migrations.CreateModel(
            name='PaymentDetails',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('paymentDate', models.DateField()),
                ('receiptNumber', models.IntegerField()),
                ('paymentAmount', models.IntegerField()),
                ('bank', models.ForeignKey(to='newapp.Banks')),
            ],
        ),
        migrations.CreateModel(
            name='PreviousHostelDetail',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('hostel_name', models.CharField(max_length=40)),
                ('room_no', models.CharField(max_length=10)),
                ('hostel_join_date', models.DateField()),
                ('hostel_leave_date', models.DateField(default=datetime.datetime.now)),
            ],
        ),
        migrations.CreateModel(
            name='Rooms',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('room_no', models.CharField(max_length=10)),
                ('capacity_of_room', models.IntegerField()),
                ('capacity_remaining', models.IntegerField(null=True, blank=True)),
                ('hostel', models.ForeignKey(to='newapp.Hostels')),
            ],
        ),
        migrations.CreateModel(
            name='Students',
            fields=[
                ('id', models.AutoField(verbose_name='ID', auto_created=True, primary_key=True, serialize=False)),
                ('username', models.CharField(default='', max_length=20, unique=True)),
                ('name', models.CharField(default='', max_length=50)),
                ('date_of_birth', models.DateField(default=datetime.datetime(2016, 5, 31, 17, 28, 32, 392983, tzinfo=utc))),
                ('distance_from_nsit', models.IntegerField(default=0)),
                ('current_hostel_join_date', models.DateField(default=datetime.datetime.now, blank=True)),
                ('gender', models.CharField(choices=[('M', 'Male'), ('F', 'Female')], max_length=10, default='M')),
                ('college_category', models.CharField(choices=[('DGEN', 'Delhi General'), ('DOB', 'Delhi OBC'), ('DSC', 'Delhi SC'), ('DST', 'Delhi ST'), ('DKM', 'Delhi Kashmiri Migrant'), ('DDC', 'Delhi Defense Category'), ('DPH', 'Delhi Physically Handicapped'), ('DOP', 'Delhi OP'), ('OGEN', 'Outside Delhi General'), ('OOB', 'Outside Delhi OBC'), ('OSC', 'Outside Delhi SC'), ('OST', 'Outside Delhi ST'), ('OKM', 'Outside Delhi Kashmiri Migrant'), ('ODC', 'Outside Delhi Defense Category'), ('OPH', 'Outside Delhi Physically Handicapped'), ('OOP', 'Outside Delhi OP')], max_length=5, default='DGEN')),
                ('blood_group', models.CharField(choices=[('B+', 'B Positive'), ('A+', 'A Positive'), ('AB+', 'AB Positive'), ('A-', 'A Neagtive'), ('B-', 'B Negative'), ('AB-', 'AB Negative'), ('O+', 'O Positive'), ('O-', 'O Negative')], max_length=5, default='B+')),
                ('student_phone_num', models.CharField(max_length=20)),
                ('student_email', models.EmailField(max_length=254, unique=True)),
                ('student_optional_phone_num', models.CharField(null=True, blank=True, max_length=20)),
                ('father_name', models.CharField(max_length=100)),
                ('mother_name', models.CharField(max_length=100)),
                ('parent_email', models.EmailField(max_length=254)),
                ('parent_phone_num', models.CharField(max_length=20)),
                ('parent_optional_phone_num', models.CharField(null=True, blank=True, max_length=20)),
                ('permanent_address', models.CharField(max_length=200)),
                ('permanent_address_zipcode', models.IntegerField(default=0)),
                ('local_guardian_name', models.CharField(default='', max_length=100)),
                ('local_guardian_address', models.CharField(default='', max_length=200)),
                ('local_guardian_address_zipcode', models.IntegerField(default=0)),
                ('local_guardian_phone_num', models.CharField(default='', max_length=20)),
                ('local_guardian_optional_phone_num', models.CharField(default='', blank=True, max_length=20)),
                ('local_guardian_email', models.EmailField(default='', max_length=254)),
                ('student_photo', models.ImageField(upload_to=newapp.models.student_photo_name)),
                ('branch', models.ForeignKey(to='newapp.Branch')),
                ('room_number', models.ForeignKey(null=True, to='newapp.Rooms')),
            ],
        ),
        migrations.AddField(
            model_name='previoushosteldetail',
            name='student',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='newapp.Students'),
        ),
        migrations.AddField(
            model_name='paymentdetails',
            name='student',
            field=models.ForeignKey(to='newapp.Students'),
        ),
        migrations.AddField(
            model_name='medicalhistory',
            name='student',
            field=models.ForeignKey(to='newapp.Students'),
        ),
        migrations.AddField(
            model_name='hostelcouncil',
            name='hostel',
            field=models.ForeignKey(to='newapp.Hostels'),
        ),
        migrations.AddField(
            model_name='hostelattachdates',
            name='student',
            field=models.ForeignKey(to='newapp.Students'),
        ),
        migrations.AddField(
            model_name='form',
            name='hostel',
            field=models.ForeignKey(to='newapp.Hostels'),
        ),
        migrations.AddField(
            model_name='facilities',
            name='hostel',
            field=models.ForeignKey(to='newapp.Hostels'),
        ),
        migrations.AddField(
            model_name='event',
            name='hostel',
            field=models.ForeignKey(to='newapp.Hostels'),
        ),
        migrations.AddField(
            model_name='criminalrecord',
            name='student',
            field=models.ForeignKey(to='newapp.Students'),
        ),
        migrations.AddField(
            model_name='complaints',
            name='hostel',
            field=models.ForeignKey(to='newapp.Hostels'),
        ),
        migrations.AddField(
            model_name='closures',
            name='hostel',
            field=models.ManyToManyField(to='newapp.Hostels'),
        ),
    ]
Esempio n. 5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.SmallIntegerField(
                    auto_created=True, primary_key=True, serialize=False
                )),
                ('name', models.CharField(
                    help_text="The group's name.", max_length=100
                )),
                ('website', models.URLField(help_text="The group's website.")),
                ('email', models.EmailField(
                    blank=True, max_length=254,
                    help_text="The group's E-mail address."
                )),
                ('discord', DiscordURLField(
                    blank=True, help_text="The group's Discord link."
                )),
                ('twitter', TwitterField(
                    blank=True, max_length=15,
                    help_text="The group's Twitter username."
                )),
                ('description', models.TextField(
                    blank=True, help_text='A description for the group.'
                )),
                ('logo', models.ImageField(
                    blank=True, help_text="Upload the group's logo."
                    " Its size must not exceed 2 MBs.",
                    storage=storage.OverwriteStorage(),
                    upload_to=uploaders.group_logo_uploader,
                    validators=[validators.FileSizeValidator(max_mb=2)]
                )),
            ],
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True,
                    serialize=False, verbose_name='ID'
                )),
                ('name', models.CharField(
                    help_text="The member's name.", max_length=100
                )),
                ('twitter', TwitterField(
                    blank=True, max_length=15,
                    help_text="The member's Twitter username."
                )),
                ('discord', DiscordNameField(
                    blank=True, max_length=37,
                    help_text="The member's Discord username and discriminator."
                )),
            ],
        ),
        migrations.CreateModel(
            name='Role',
            fields=[
                ('id', models.AutoField(
                    auto_created=True, primary_key=True,
                    serialize=False, verbose_name='ID'
                )),
                ('role', models.CharField(
                    choices=[
                        ('LD', 'Leader'),
                        ('TL', 'Translator'),
                        ('PR', 'Proofreader'),
                        ('CL', 'Cleaner'),
                        ('RD', 'Redrawer'),
                        ('TS', 'Typesetter'),
                        ('RP', 'Raw Provider'),
                        ('QC', 'Quality Checker')
                    ], max_length=2
                )),
                ('group', models.ForeignKey(
                    on_delete=models.deletion.CASCADE,
                    related_name='roles', to='groups.Group'
                )),
                ('member', models.ForeignKey(
                    on_delete=models.deletion.CASCADE,
                    related_name='roles', to='groups.Member'
                )),
            ],
            options={
                'verbose_name': 'Role',
            },
        ),
        migrations.AlterUniqueTogether(
            name='role',
            unique_together={('member', 'role', 'group')},
        ),
    ]
Esempio n. 6
0
class User(AbstractUser):
    bio = models.TextField(blank=True)
    email = models.EmailField(unique=True)
    role = models.CharField(
        max_length=255, choices=UserRole.choices, default=UserRole.USER
    )
Esempio n. 7
0
 class NewsLetterRecipients(models.Model):
     name = models.CharField(max_length=30)
     email = models.EmailField()
Esempio n. 8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Customer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name', models.CharField(max_length=100)),
                ('last_name', models.CharField(max_length=100)),
                ('email', models.EmailField(max_length=100)),
                ('mobile', models.BigIntegerField()),
                ('address', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Employee',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Executive',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Service_Assign',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Service_Uplode',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
            ],
        ),
        migrations.CreateModel(
            name='Vendor',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('discription',
                 models.TextField(blank=True, max_length=255, null=True)),
                ('weight',
                 models.IntegerField(blank=True, max_length=100, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('v_p',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='modelapp.Vendor')),
            ],
        ),
    ]