rhazdon/django-sonic-screwdriver

View on GitHub
django_sonic_screwdriver/apps/ban/migrations/0001_initial.py

Summary

Maintainability
A
1 hr
Test Coverage
# Generated by Django 3.0.2 on 2020-01-23 13:24

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='UserBan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Model was created at this time.', verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Model was updated at this time.', verbose_name='Updated at')),
                ('end_date', models.DateTimeField(blank=True, help_text='The end date tells, until the ban is valid. If the end_date is empty, the ban is infinit.', null=True, verbose_name='End date of the ban')),
                ('banned_user', models.ForeignKey(help_text='This is the banned user or the receiver of the ban.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='banned_user', to=settings.AUTH_USER_MODEL, verbose_name='User')),
                ('creator', models.ForeignKey(help_text='This is the creator of the ban. If the creator is empty, the ban was created by the system.', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'User Ban',
                'verbose_name_plural': 'User Bans',
            },
        ),
        migrations.CreateModel(
            name='IPBan',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, help_text='Model was created at this time.', verbose_name='Created at')),
                ('updated_at', models.DateTimeField(auto_now=True, help_text='Model was updated at this time.', verbose_name='Updated at')),
                ('end_date', models.DateTimeField(blank=True, help_text='The end date tells, until the ban is valid. If the end_date is empty, the ban is infinit.', null=True, verbose_name='End date of the ban')),
                ('ip', models.GenericIPAddressField(help_text='This is the banned ip. Every request from this IP will result in 403.', null=True, verbose_name='IP')),
                ('creator', models.ForeignKey(help_text='This is the creator of the ban. If the creator is empty, the ban was created by the system.', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'verbose_name': 'IP Ban',
                'verbose_name_plural': 'IP Bans',
            },
        ),
    ]