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

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='ChatRoom',
            fields=[
                ('id',
                 models.TextField(primary_key=True,
                                  serialize=False,
                                  unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  editable=False,
                                  primary_key=True,
                                  serialize=False)),
                ('content',
                 models.TextField(
                     validators=[chat.models.validate_message_content])),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('chatgroup',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='chat.ChatRoom')),
            ],
        ),
    ]
Esempio n. 2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  editable=False,
                                  primary_key=True,
                                  serialize=False)),
                ('content',
                 models.TextField(validators=[chat.models.validate_content])),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('room', models.CharField(max_length=100)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='author_messages',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Esempio n. 3
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')),
                ('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')),
                ('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')),
                ('last_read_date', models.DateTimeField(auto_now_add=True)),
                ('online', 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', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('content', models.TextField(validators=[chat.models.validate_message_content])),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='author_messages', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Esempio n. 4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='LastSeen',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date', models.DateTimeField(auto_now=True)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='DirectChatMessage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(max_length=1000)),
                ('seen', models.BooleanField(default=False)),
                ('date', models.DateTimeField(auto_now_add=True)),
                ('uuid', models.UUIDField(default=uuid.uuid4, unique=True)),
                ('file_type', models.IntegerField(default=0)),
                ('_from',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='+',
                                   to=settings.AUTH_USER_MODEL)),
                ('_to',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='+',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Clients',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('channel_name', models.TextField(max_length=1000)),
                ('username',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ChatFiles',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('is_image', models.BooleanField()),
                ('file', models.FileField(upload_to=chat.models.get_chat_dir)),
                ('chat',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='chat.directchatmessage')),
            ],
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Messages',
            fields=[
                ('MessageID',
                 models.UUIDField(default=uuid.uuid4,
                                  editable=False,
                                  primary_key=True,
                                  serialize=False)),
                ('MessageType',
                 models.CharField(choices=[('text', 'Text'),
                                           ('image', 'Image'),
                                           ('video', 'Video'),
                                           ('audio', 'Audio'),
                                           ('file', 'File'),
                                           ('adduser', 'Add User'),
                                           ('removeuser', 'Add User'),
                                           ('audiocall', 'Audio Call'),
                                           ('videocall', 'Video Call')],
                                  max_length=50,
                                  verbose_name='Message Type')),
                ('CreatedOn',
                 models.DateTimeField(auto_now_add=True, db_index=True)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='Rooms',
            fields=[
                ('RoomID',
                 models.UUIDField(default=uuid.uuid4,
                                  editable=False,
                                  primary_key=True,
                                  serialize=False)),
                ('polymorphic_ctype',
                 models.ForeignKey(editable=False,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='polymorphic_chat.rooms_set+',
                                   to='contenttypes.ContentType')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='CallsLog',
            fields=[
                ('messages_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='chat.Messages')),
                ('StartedAt', models.DateTimeField(auto_now_add=True)),
                ('AnsweredAt', models.DateTimeField(blank=True, null=True)),
                ('EndedAt', models.DateTimeField(blank=True, null=True)),
                ('Duration', models.IntegerField(blank=True, null=True)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('chat.messages', ),
        ),
        migrations.CreateModel(
            name='MediaMessage',
            fields=[
                ('messages_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='chat.Messages')),
                ('Media', models.FileField(upload_to='')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('chat.messages', ),
        ),
        migrations.CreateModel(
            name='TextMessage',
            fields=[
                ('messages_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='chat.Messages')),
                ('Content', models.TextField()),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('chat.messages', ),
        ),
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('ProfileImg',
                 models.FileField(blank=True,
                                  null=True,
                                  upload_to=chat.models.path_and_rename,
                                  validators=[chat.models.validate_is_image])),
                ('LastSeen', models.DateTimeField(auto_now_add=True)),
                ('User',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'User Profiles',
                'verbose_name_plural': 'User Profiles',
            },
        ),
        migrations.AddField(
            model_name='messages',
            name='Room',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING,
                to='chat.Rooms'),
        ),
        migrations.AddField(
            model_name='messages',
            name='Sender',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.DO_NOTHING,
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='messages',
            name='polymorphic_ctype',
            field=models.ForeignKey(
                editable=False,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='polymorphic_chat.messages_set+',
                to='contenttypes.ContentType'),
        ),
        migrations.CreateModel(
            name='GroupRooms',
            fields=[
                ('rooms_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='chat.Rooms')),
                ('RoomName',
                 models.CharField(max_length=250, verbose_name='Room Name')),
                ('AdminMembers',
                 models.ManyToManyField(related_name='adminmembers',
                                        to=settings.AUTH_USER_MODEL)),
                ('Members',
                 models.ManyToManyField(related_name='members',
                                        to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
            bases=('chat.rooms', ),
        ),
        migrations.CreateModel(
            name='DirectRooms',
            fields=[
                ('rooms_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='chat.Rooms')),
                ('User1',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='user1',
                                   to=settings.AUTH_USER_MODEL)),
                ('User2',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='user2',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'unique_together': {('User1', 'User2')},
            },
            bases=('chat.rooms', ),
        ),
    ]