# Generated by Django 3.2.5 on 2021-11-27 12:57

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

from weblate.trans.models.projecttoken import generate_token


class Migration(migrations.Migration):

    dependencies = [
        ("trans", "0141_alter_component_commit_pending_age"),
    ]

    operations = [
        migrations.CreateModel(
            name="ProjectToken",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="Name")),
                (
                    "token",
                    models.CharField(
                        default=generate_token,
                        help_text="Token value to use in API",
                        max_length=100,
                        verbose_name="Token value",
                    ),
                ),
                ("expires", models.DateTimeField(verbose_name="Expires")),
                (
                    "project",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="trans.project"
                    ),
                ),
            ],
            options={
                "verbose_name": "Project Token",
                "verbose_name_plural": "Project Tokens",
                "unique_together": {("project", "token"), ("project", "name")},
            },
        ),
    ]
