Fakultas Ilmu Komputer UI

Commit 5715ff99 authored by Jonathan Christopher Jakub's avatar Jonathan Christopher Jakub
Browse files

[CHORES] Fix internal field on account model and factory

parent b22656a6
Pipeline #34457 passed with stage
in 1 minute and 58 seconds
# Generated by Django 3.0.1 on 2020-02-24 09:13
# Generated by Django 3.0.1 on 2020-03-03 15:02
from django.conf import settings
from django.db import migrations, models
......@@ -16,31 +16,22 @@ class Migration(migrations.Migration):
operations = [
migrations.CreateModel(
name="Account",
name='Account',
fields=[
(
"id",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
),
),
("name", models.CharField(max_length=128)),
("email", models.EmailField(max_length=128)),
("phone_number", models.CharField(max_length=64)),
("area", models.CharField(max_length=128)),
("is_admin", models.BooleanField(default=False)),
("is_verified", models.BooleanField(default=False)),
("is_active", models.BooleanField(default=False)),
(
"user",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL,
),
),
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=128)),
('email', models.EmailField(max_length=128)),
('phone_number', models.CharField(max_length=64)),
('area', models.CharField(max_length=128)),
('is_admin', models.BooleanField(default=False)),
('is_verified', models.BooleanField(default=False)),
('is_active', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name_plural': 'accounts',
'db_table': 'account',
},
),
]
import uuid
from django.contrib.auth.models import User
from django.db import models
class Account(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.OneToOneField(User, on_delete=models.CASCADE)
......@@ -14,3 +12,10 @@ class Account(models.Model):
is_admin = models.BooleanField(default=False)
is_verified = models.BooleanField(default=False)
is_active = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
objects = models.Manager()
class Meta:
db_table = "account"
verbose_name_plural = "accounts"
......@@ -12,7 +12,7 @@ class UserFactory(factory.DjangoModelFactory):
class Meta:
model = User
username = "username"
username = factory.Sequence(lambda n: "user_" + str(n))
password = "justpass"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment