Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angelico Ruiz T. Teaño
widget_Alipins
Commits
898dab2b
Commit
898dab2b
authored
Apr 02, 2022
by
Irish Danielle Morales
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change WidgetUser id_num from integer to string of integers
parent
228cb14e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
db.sqlite3
widget_alipins/db.sqlite3
+0
-0
0005_alter_widgetuser_id_num.py
...ipins/homepage/migrations/0005_alter_widgetuser_id_num.py
+19
-0
models.py
widget_alipins/homepage/models.py
+5
-4
No files found.
widget_alipins/db.sqlite3
View file @
898dab2b
No preview for this file type
widget_alipins/homepage/migrations/0005_alter_widgetuser_id_num.py
0 → 100644
View file @
898dab2b
# Generated by Django 4.0.3 on 2022-04-02 10:10
import
django.core.validators
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0004_widgetuser_department'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'widgetuser'
,
name
=
'id_num'
,
field
=
models
.
CharField
(
max_length
=
7
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
'^
\\
d+$'
)]),
),
]
widget_alipins/homepage/models.py
View file @
898dab2b
from
django.core.validators
import
MaxValue
Validator
from
django.core.validators
import
Regex
Validator
from
django.db
import
models
from
django.db
import
models
...
@@ -14,9 +14,10 @@ class WidgetUser(models.Model):
...
@@ -14,9 +14,10 @@ class WidgetUser(models.Model):
first_name
=
models
.
CharField
(
max_length
=
50
)
first_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
last_name
=
models
.
CharField
(
max_length
=
50
)
last_name
=
models
.
CharField
(
max_length
=
50
)
id_num
=
models
.
PositiveIntegerField
(
validators
=
[
MaxValueValidator
(
9999999
)])
# check if id_num string contains digits only
email
=
models
.
EmailField
(
max_length
=
200
)
id_num
=
models
.
CharField
(
max_length
=
7
,
validators
=
[
RegexValidator
(
r'^\d+$'
)])
email
=
models
.
EmailField
(
max_length
=
200
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
email
return
self
.
id_num
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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