class Classify(models.Model):
    ClassifyID = models.AutoField(primary_key=True)
    ClassifyName = models.CharField(max_length=50)
    TagColor = models.CharField(max_length=20)

    def __str__(self):
        return self.ClassifyName
Example #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    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')),
                ('contact_number',
                 models.CharField(
                     max_length=10,
                     unique=True,
                     validators=[users.models.validate_contact_number],
                     verbose_name='Contact Number')),
                ('is_staff', models.BooleanField(default=False)),
                ('is_superuser', models.BooleanField(default=False)),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
class Comment(models.Model):
    CommentID = models.AutoField(primary_key=True)
    RoadQuery = models.ForeignKey(RoadQuery, on_delete=models.PROTECT, related_name='Comment_RoadQuery')
    User = models.ForeignKey(UserAccount, on_delete=models.PROTECT, related_name='Comment_User')
    StarAmount = models.IntegerField(default=1, validators=[MaxValueValidator(5), MinValueValidator(-5)])
    CommentContent = models.CharField(max_length=200)
    CreateDate = models.DateField()

    def __str__(self):
        return self.RoadQuery.RoadQueryName + ':' + str(self.StarAmount)
class RoadQuery(models.Model):
    RoadQueryID = models.AutoField(primary_key=True)
    RoadQueryName = models.CharField(max_length=50)
    RoadQueryAddress = models.CharField(max_length=50)
    RoadQueryPicture = models.CharField(max_length=100, blank=True)
    Classify = models.ManyToManyField(Classify)
    Introduction = models.TextField()
    Star = models.IntegerField(default=0)
    OpenTime = models.CharField(max_length=50)
    Latitude = models.CharField(max_length=30)
    Longitude = models.CharField(max_length=30)
    CreateUser = models.ForeignKey(UserAccount, on_delete=models.PROTECT, related_name='RoadQuery_CreateUser')
    CreateDate = models.DateTimeField()
    ModifyDate = models.DateTimeField()

    def __str__(self):
        return self.RoadQueryName
Example #5
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',
                    ),
                ),
                ('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', users.models.UserManager())],
        ),
    ]
Example #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_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')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('first_name', models.CharField(max_length=100)),
                ('last_name', models.CharField(max_length=100)),
                ('username', models.CharField(max_length=100)),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email')),
                ('country',
                 django_countries.fields.CountryField(blank=True,
                                                      max_length=2,
                                                      null=True)),
                ('profile_picutre',
                 models.ImageField(blank=True,
                                   default='users_images/default_avatar.png',
                                   null=True,
                                   upload_to='users_images/')),
                ('phone_number',
                 models.CharField(
                     blank=True,
                     max_length=16,
                     null=True,
                     validators=[
                         django.core.validators.RegexValidator(
                             message=
                             'Phone number must be entered in the egyption format',
                             regex='(01)[0-9]{9}$')
                     ])),
                ('birth_date', models.DateField(null=True)),
                ('is_admin', models.BooleanField(default=False)),
                ('is_superuser', models.BooleanField(default=False)),
                ('is_staff', models.BooleanField(default=False)),
                ('is_active', models.BooleanField(default=False)),
                ('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', users.models.UserAccountManager()),
            ],
        ),
    ]