Ejemplo n.º 1
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,
            },
        ),
    ]
Ejemplo n.º 2
0
class Rate(models.Model):
    up = models.BooleanField(default=True)
    voter = models.ForeignKey('users.KUser', related_name='rates')
    knowledge = models.ForeignKey('Knowledge', related_name='rates')

    class Meta:
        unique_together = ['voter', 'knowledge']

    def __str__(self):
        return str(self.knowledge) + ' vote ' + (
            'up' if self.up else 'down') + ' by ' + str(self.voter)
Ejemplo n.º 3
0
class CardCell(models.Model):
    SUITS = (("C", "Clubs"), ("S", "Spades"), ("D", "Diamonds"), ("H",
                                                                  "Hearts"))
    VALUES = (("J", "Jack"), ("Q", "Queen"), ("K", "King"))
    GROUPS = (("A", "A"), ("B", "B"), ("C", "C"))
    game = models.ForeignKey(Cards, related_name="cells")
    suit = models.CharField(max_length=1, choices=SUITS)
    value = models.CharField(max_length=1, choices=VALUES)
    group = models.CharField(max_length=1, choices=GROUPS)
    total_bets = models.PositiveIntegerField(default=0)
    winner = models.BooleanField(default=False)

    class Meta:
        unique_together = ("game", "suit", "value", "group")
Ejemplo n.º 4
0
class TileCell(models.Model):
    SUITS = (
        ("A", "A"),
        ("B", "B"),
    )
    VALUES = (
        ("1", "1"),
        ("2", "2"),
        ("3", "3"),
        ("4", "4"),
        ("5", "5"),
    )
    GROUPS = (("A", "A"), ("B", "B"), ("C", "C"))
    game = models.ForeignKey(Tiles, related_name="cells")
    suit = models.CharField(max_length=1, choices=SUITS)
    value = models.CharField(max_length=1, choices=VALUES)
    group = models.CharField(max_length=1, choices=GROUPS)
    total_bets = models.PositiveIntegerField(default=0)
    winner = models.BooleanField(default=False)

    class Meta:
        unique_together = ("game", "suit", "value", "group")
Ejemplo n.º 5
0
class Cards(models.Model):
    ticket_cost = models.PositiveIntegerField(default=11)
    winner_prize = models.PositiveIntegerField(default=100)
    is_result_generated = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)
Ejemplo n.º 6
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())],
        ),
    ]
Ejemplo n.º 7
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()),
            ],
        ),
    ]