Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
2020
PPL-C
PPTI-Mobile Apps Monitoring Wabah Tuberkolosis
Neza-Backend
Commits
5715ff99
Commit
5715ff99
authored
Mar 03, 2020
by
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
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
apps/accounts/migrations/0001_initial.py
View file @
5715ff99
# Generated by Django 3.0.1 on 2020-0
2-24 09:13
# Generated by Django 3.0.1 on 2020-0
3-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'
,
},
),
]
apps/accounts/models.py
View file @
5715ff99
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"
apps/accounts/tests/factories/accounts.py
View file @
5715ff99
...
...
@@ -12,7 +12,7 @@ class UserFactory(factory.DjangoModelFactory):
class
Meta
:
model
=
User
username
=
"username"
username
=
factory
.
Sequence
(
lambda
n
:
"user_"
+
str
(
n
))
password
=
"justpass"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment