Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csentry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Harrisson
csentry
Commits
ccf0447d
Commit
ccf0447d
authored
7 years ago
by
Benjamin Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
Remove name column from Item
Most items won't have a name. hostname could be added in a separate table if required.
parent
a738d0b4
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/api/main.py
+0
-1
0 additions, 1 deletion
app/api/main.py
app/main/views.py
+0
-1
0 additions, 1 deletion
app/main/views.py
app/models.py
+1
-4
1 addition, 4 deletions
app/models.py
app/templates/index.html
+0
-1
0 additions, 1 deletion
app/templates/index.html
with
1 addition
and
7 deletions
app/api/main.py
+
0
−
1
View file @
ccf0447d
...
...
@@ -98,7 +98,6 @@ def patch_item(item_id):
item
=
Item
.
query
.
get
(
item_id
)
if
item
is
None
:
raise
utils
.
InventoryError
(
f
'
Unknown item id:
{
item_id
}
'
,
status_code
=
422
)
item
.
name
=
data
.
get
(
'
name
'
,
item
.
name
)
item
.
manufacturer
=
utils
.
convert_to_model
(
data
.
get
(
'
manufacturer
'
,
item
.
manufacturer
),
Manufacturer
)
item
.
model
=
utils
.
convert_to_model
(
data
.
get
(
'
model
'
,
item
.
model
),
Model
)
item
.
location
=
utils
.
convert_to_model
(
data
.
get
(
'
location
'
,
item
.
location
),
Location
)
...
...
This diff is collapsed.
Click to expand it.
app/main/views.py
+
0
−
1
View file @
ccf0447d
...
...
@@ -42,7 +42,6 @@ def retrieve_items():
items
=
Item
.
query
.
order_by
(
Item
.
_created
)
data
=
[[
item
.
id
,
item
.
serial_number
,
item
.
name
,
utils
.
format_field
(
item
.
manufacturer
),
utils
.
format_field
(
item
.
model
),
utils
.
format_field
(
item
.
location
),
...
...
This diff is collapsed.
Click to expand it.
app/models.py
+
1
−
4
View file @
ccf0447d
...
...
@@ -220,7 +220,6 @@ class Item(db.Model):
_created
=
db
.
Column
(
db
.
DateTime
,
default
=
db
.
func
.
now
())
_updated
=
db
.
Column
(
db
.
DateTime
,
default
=
db
.
func
.
now
(),
onupdate
=
db
.
func
.
now
())
serial_number
=
db
.
Column
(
db
.
String
(
100
),
nullable
=
False
)
name
=
db
.
Column
(
db
.
String
(
100
))
hash
=
db
.
Column
(
GUID
,
unique
=
True
)
manufacturer_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
manufacturer.id
'
))
model_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'
model.id
'
))
...
...
@@ -234,10 +233,9 @@ class Item(db.Model):
status
=
db
.
relationship
(
'
Status
'
,
back_populates
=
'
items
'
)
children
=
db
.
relationship
(
'
Item
'
,
backref
=
db
.
backref
(
'
parent
'
,
remote_side
=
[
id
]))
def
__init__
(
self
,
serial_number
=
None
,
name
=
None
,
manufacturer
=
None
,
model
=
None
,
location
=
None
,
status
=
None
):
def
__init__
(
self
,
serial_number
=
None
,
manufacturer
=
None
,
model
=
None
,
location
=
None
,
status
=
None
):
# All arguments must be optional for this class to work with flask-admin!
self
.
serial_number
=
serial_number
self
.
name
=
name
self
.
manufacturer
=
utils
.
convert_to_model
(
manufacturer
,
Manufacturer
)
self
.
model
=
utils
.
convert_to_model
(
model
,
Model
)
self
.
location
=
utils
.
convert_to_model
(
location
,
Location
)
...
...
@@ -251,7 +249,6 @@ class Item(db.Model):
return
{
'
id
'
:
self
.
id
,
'
serial_number
'
:
self
.
serial_number
,
'
name
'
:
self
.
name
,
'
hash
'
:
self
.
hash
,
'
manufacturer
'
:
utils
.
format_field
(
self
.
manufacturer
),
'
model
'
:
utils
.
format_field
(
self
.
model
),
...
...
This diff is collapsed.
Click to expand it.
app/templates/index.html
+
0
−
1
View file @
ccf0447d
...
...
@@ -10,7 +10,6 @@
<tr>
<th>
Id
</th>
<th>
Serial number
</th>
<th>
name
</th>
<th>
Manufacturer
</th>
<th>
Model
</th>
<th>
Location
</th>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment