File: 0001_initial.py

package info (click to toggle)
lava 2024.09-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 29,616 kB
  • sloc: python: 79,650; javascript: 16,875; sh: 1,364; makefile: 336
file content (73 lines) | stat: -rw-r--r-- 2,357 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright (C) 2015 Linaro Limited
#
# Author: Neil Williams <neil.williams@linaro.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later

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

import linaro_django_xmlrpc.models


class Migration(migrations.Migration):
    dependencies = [
        ("auth", "__first__"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="AuthToken",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "secret",
                    models.CharField(
                        default=linaro_django_xmlrpc.models._make_secret,
                        help_text="Secret randomly generated text that grants user access instead of their regular password",
                        unique=True,
                        max_length=128,
                    ),
                ),
                (
                    "description",
                    models.TextField(
                        default="",
                        help_text="Arbitrary text that helps the user to associate tokens with their intended purpose",
                        blank=True,
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        help_text="Time and date when the token was created",
                        auto_now=True,
                    ),
                ),
                (
                    "last_used_on",
                    models.DateTimeField(
                        help_text="Time and date when the token was last used",
                        null=True,
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        related_name="auth_tokens",
                        to=settings.AUTH_USER_MODEL,
                        on_delete=models.CASCADE,
                    ),
                ),
            ],
        )
    ]