Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Requirement Formalization Tool
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
Thodoris Nestoridis
Requirement Formalization Tool
Commits
68e6abca
Commit
68e6abca
authored
Mar 04, 2021
by
Thodoris Nestoridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new table for data to show in frontend
parent
11f7574f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
165 additions
and
52 deletions
+165
-52
boilerplate-details.component.ts
...ents/boilerplate-details/boilerplate-details.component.ts
+1
-0
boilerplate-list.component.html
...mponents/boilerplate-list/boilerplate-list.component.html
+35
-35
boilerplate-list.component.ts
...components/boilerplate-list/boilerplate-list.component.ts
+28
-1
boilerplate.model.ts
reqtool/ReqmanAngular11/src/app/models/boilerplate.model.ts
+8
-0
boilerplate.service.ts
...l/ReqmanAngular11/src/app/services/boilerplate.service.ts
+4
-0
requirements.py
...ool/reqman/api/reqman/apps/reqtool/models/requirements.py
+39
-2
suffix_req.py
reqtool/reqman/api/reqman/apps/reqtool/models/suffix_req.py
+4
-4
main_req.py
.../api/reqman/apps/reqtool/rest_api/serializers/main_req.py
+1
-1
requirements.py
.../reqman/apps/reqtool/rest_api/serializers/requirements.py
+8
-2
suffix_req.py
...pi/reqman/apps/reqtool/rest_api/serializers/suffix_req.py
+1
-1
urls.py
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
+1
-0
main_req_views.py
.../api/reqman/apps/reqtool/rest_api/views/main_req_views.py
+7
-1
requirements_views.py
.../reqman/apps/reqtool/rest_api/views/requirements_views.py
+21
-5
suffix_req_views.py
...pi/reqman/apps/reqtool/rest_api/views/suffix_req_views.py
+7
-0
No files found.
reqtool/ReqmanAngular11/src/app/components/boilerplate-details/boilerplate-details.component.ts
View file @
68e6abca
...
...
@@ -48,6 +48,7 @@ export class BoilerplateDetailsComponent implements OnInit {
response
=>
{
console
.
log
(
response
);
this
.
message
=
response
.
message
;
window
.
location
.
reload
();
},
error
=>
{
console
.
log
(
error
);
...
...
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.html
View file @
68e6abca
...
...
@@ -20,44 +20,44 @@
</div>
</div>
</div>
<table
mat-table
[
dataSource
]="
dataSource
"
class=
"mat-elevation-z8"
>
<table
mat-table
[
dataSource
]="
newdataSource
"
class=
"mat-elevation-z8"
>
<!-- Position Column -->
<ng-container
matColumnDef=
"id"
>
<th
mat-header-cell
*
matHeaderCellDef
>
No.
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.id}}
</td>
</ng-container>
<!-- Position Column -->
<ng-container
matColumnDef=
"id"
>
<th
mat-header-cell
*
matHeaderCellDef
>
No.
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.id}}
</td>
</ng-container>
<!-- Name Column -->
<ng-container
matColumnDef=
"title
"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Title
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.title
}}
</td>
</ng-container>
<!-- Weight
Column -->
<ng-container
matColumnDef=
"has_prefix
"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Prefix
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.has_prefix
}}
</td>
</ng-container>
<!-- Name Column -->
<ng-container
matColumnDef=
"prefix_data
"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Prefix
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.prefix_data
}}
</td>
</ng-container>
<!-- Name
Column -->
<ng-container
matColumnDef=
"title_data
"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Title
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.title_data
}}
</td>
</ng-container>
<!-- Symbol Column -->
<ng-container
matColumnDef=
"has_main"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Main
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.has_main}}
</td>
</ng-container>
<!-- Symbol Column -->
<ng-container
matColumnDef=
"has_suffix"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Suffix
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.has_suffix}}
</td>
</ng-container>
<ng-container
matColumnDef=
"main_data"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Main
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.main_data}}
</td>
</ng-container>
<!-- Action Column -->
<ng-container
matColumnDef=
"action"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Action
</th>
<td
mat-cell
*
matCellDef=
"let element"
class=
"action-link"
>
<a
class=
"badge badge-warning"
routerLink=
"/boilerplates/{{ element.id }}"
>
Edit
</a>
</td>
</ng-container>
<ng-container
matColumnDef=
"suffix_data"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Suffix
</th>
<td
mat-cell
*
matCellDef=
"let element"
>
{{element.suffix_data}}
</td>
</ng-container>
<!-- Action Column -->
<ng-container
matColumnDef=
"action"
>
<th
mat-header-cell
*
matHeaderCellDef
>
Action
</th>
<td
mat-cell
*
matCellDef=
"let element"
class=
"action-link"
>
<a
class=
"badge badge-warning"
routerLink=
"/boilerplates/{{ element.id }}"
>
Edit
</a>
</td>
</ng-container>
<tr
mat-header-row
*
matHeaderRowDef=
"
displayedColumns"
></tr>
<tr
mat-row
*
matRowDef=
"let row; columns:
displayedColumns;"
></tr>
<tr
mat-header-row
*
matHeaderRowDef=
"new
displayedColumns"
></tr>
<tr
mat-row
*
matRowDef=
"let row; columns: new
displayedColumns;"
></tr>
</table>
reqtool/ReqmanAngular11/src/app/components/boilerplate-list/boilerplate-list.component.ts
View file @
68e6abca
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Boilerplate
}
from
'src/app/models/boilerplate.model'
;
import
{
BoilerplateData
}
from
'src/app/models/boilerplate.model'
;
import
{
BoilerplateService
}
from
'src/app/services/boilerplate.service'
;
import
{
PrefixService
}
from
'src/app/services/prefix.service'
;
...
...
@@ -13,16 +15,26 @@ import { BoilerplateService } from 'src/app/services/boilerplate.service';
export
class
BoilerplateListComponent
implements
OnInit
{
boilerplates
?:
Boilerplate
[];
boilerplatesdata
?:
BoilerplateData
[];
currentBoilerplate
?:
Boilerplate
;
currentBoilerplatedata
?:
BoilerplateData
;
currentIndex
=
-
1
;
title
=
''
;
displayedColumns
:
string
[]
=
[
'id'
,
'title'
,
'has_prefix'
,
'has_main'
,
'has_suffix'
,
'action'
];
newdisplayedColumns
:
string
[]
=
[
'id'
,
'title_data'
,
'prefix_data'
,
'main_data'
,
'suffix_data'
,
'action'
];
dataSource
:
Boilerplate
[]
=
[{}];
newdataSource
:
BoilerplateData
[]
=
[{}];
dataofboilerplates
:
any
[]
=
[];
aprefix
:
any
[]
=
[];
main
:
any
;
suffix
:
any
;
constructor
(
private
boilerplateService
:
BoilerplateService
)
{
}
constructor
(
private
boilerplateService
:
BoilerplateService
,
private
prefixService
:
PrefixService
)
{
}
ngOnInit
():
void
{
this
.
retrieveBoilerplates
();
this
.
retrieve
();
}
retrieveBoilerplates
():
void
{
...
...
@@ -38,6 +50,21 @@ export class BoilerplateListComponent implements OnInit {
}
retrieve
():
void
{
this
.
boilerplateService
.
getAllData
()
.
subscribe
(
data
=>
{
this
.
boilerplatesdata
=
data
;
this
.
newdataSource
=
data
;
console
.
log
(
data
)
},
error
=>
{
console
.
log
(
error
);
});
}
refreshList
():
void
{
this
.
retrieveBoilerplates
();
this
.
currentBoilerplate
=
undefined
;
...
...
reqtool/ReqmanAngular11/src/app/models/boilerplate.model.ts
View file @
68e6abca
...
...
@@ -5,3 +5,11 @@ export class Boilerplate {
has_main
?:
boolean
;
has_suffix
?:
boolean
;
}
export
class
BoilerplateData
{
id
?:
any
;
title_data
?:
string
;
prefix_data
?:
string
;
main_data
?:
string
;
suffix_data
?:
string
;
}
\ No newline at end of file
reqtool/ReqmanAngular11/src/app/services/boilerplate.service.ts
View file @
68e6abca
...
...
@@ -17,6 +17,10 @@ export class BoilerplateService {
return
this
.
http
.
get
<
Boilerplate
[]
>
(
baseUrl
);
}
getAllData
():
Observable
<
Boilerplate
[]
>
{
return
this
.
http
.
get
<
Boilerplate
[]
>
(
baseUrl
+
`boilerplatedata/`
);
}
get
(
id
:
any
):
Observable
<
Boilerplate
>
{
return
this
.
http
.
get
(
`
${
baseUrl
}${
id
}
`
);
}
...
...
reqtool/reqman/api/reqman/apps/reqtool/models/requirements.py
View file @
68e6abca
...
...
@@ -55,6 +55,9 @@ def create_prefix(instance):
prefix
=
Prefix
(
prefix_boilerplate
=
instance
.
boilerplate
,
prefixgroup
=
instance
)
prefix
.
save
()
def
create_data
(
instance
):
data
=
BoilerplateData
(
boilerplate_data_id
=
instance
,
owner_data
=
instance
.
owner
,
title_data
=
instance
.
title
)
data
.
save
()
def
create_extra_prefix
(
instance
,
now_prefix
):
prefix
=
Prefix
(
prefixgroup
=
instance
.
prefixgroup
,
prefix_boilerplate
=
instance
.
prefix_boilerplate
)
...
...
@@ -68,15 +71,38 @@ class Boilerplate(models.Model):
has_prefix
=
models
.
BooleanField
(
default
=
False
)
has_main
=
models
.
BooleanField
(
default
=
False
)
has_suffix
=
models
.
BooleanField
(
default
=
False
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
Boilerplate
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
__important_fields
=
[
'has_prefix'
,
'has_main'
,
'has_suffix'
]
for
field
in
self
.
__important_fields
:
setattr
(
self
,
'__original_
%
s'
%
field
,
getattr
(
self
,
field
))
def
save
(
self
,
**
kwargs
):
"""Create prefix, main or suffix """
super
(
Boilerplate
,
self
)
.
save
(
**
kwargs
)
prev_prefix_list
=
[]
for
field
in
self
.
__important_fields
:
orig
=
'__original_
%
s'
%
field
previous_simple_prefix
=
getattr
(
self
,
orig
)
prev_prefix_list
.
append
(
previous_simple_prefix
)
create_prefixgroup
(
self
)
create_main
(
self
)
create_suffix
(
self
)
if
(
prev_prefix_list
[
0
]
==
True
and
self
.
has_prefix
==
False
):
pr
=
""
BoilerplateData
.
objects
.
filter
(
owner_data
=
self
.
owner
,
boilerplate_data_id
=
self
)
.
update
(
prefix_data
=
pr
)
elif
(
prev_prefix_list
[
1
]
==
True
and
self
.
has_main
==
False
):
pr
=
""
BoilerplateData
.
objects
.
filter
(
owner_data
=
self
.
owner
,
boilerplate_data_id
=
self
)
.
update
(
main_data
=
pr
)
elif
(
prev_prefix_list
[
2
]
==
True
and
self
.
has_suffix
==
False
):
pr
=
""
BoilerplateData
.
objects
.
filter
(
owner_data
=
self
.
owner
,
boilerplate_data_id
=
self
)
.
update
(
suffix_data
=
pr
)
elif
(
BoilerplateData
.
objects
.
filter
(
owner_data
=
self
.
owner
,
boilerplate_data_id
=
self
)
.
count
()
!=
1
):
create_data
(
self
)
class
Meta
:
ordering
=
[
'created'
]
...
...
@@ -134,3 +160,14 @@ class Prefix(models.Model):
class
Meta
:
ordering
=
[
'prefix_boilerplate'
]
class
BoilerplateData
(
models
.
Model
):
owner_data
=
models
.
ForeignKey
(
User
,
related_name
=
'boilerplate_data'
,
on_delete
=
models
.
CASCADE
)
boilerplate_data_id
=
models
.
ForeignKey
(
Boilerplate
,
related_name
=
'boilerplate_data_id'
,
on_delete
=
models
.
CASCADE
)
title_data
=
models
.
CharField
(
default
=
""
,
max_length
=
30
,
unique
=
True
)
prefix_data
=
models
.
CharField
(
default
=
""
,
max_length
=
100
,
blank
=
True
)
main_data
=
models
.
CharField
(
default
=
""
,
max_length
=
100
,
blank
=
True
)
suffix_data
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
)
class
Meta
:
ordering
=
[
'boilerplate_data_id'
]
\ No newline at end of file
reqtool/reqman/api/reqman/apps/reqtool/models/suffix_req.py
View file @
68e6abca
...
...
@@ -16,10 +16,10 @@ SUFFIX_CHOICES = (("",""), ('S1', 'S1: <numerical-affirmative> j <closed-interva
(
'S5'
,
'S5: at even intervals'
),
(
'S6'
,
'S6: sequentially'
)
)
NUMERICAL_AFFIRMATIVE_CHOICES
=
((
"
more than"
,
"MORE THAN"
),
(
"less than"
,
"LESS THAN"
),
(
"exactly
"
,
"EXACTLY"
),
(
"
at least"
,
"AT LEAST"
),
(
"at most
"
,
"AT MOST"
))
NUMBER_UNITS_CHOICES
=
((
""
,
""
),
(
"
meters"
,
"METERS"
),
(
"kilometers"
,
"KILOMETERS"
),
(
"volt
"
,
"VOLT"
))
TIME_UNITS_CHOICES
=
((
"
seconds"
,
"SECONDS"
),
(
"minutes"
,
"MINUTES"
),
(
"milliseconds
"
,
"MILLISECONDS"
))
NUMERICAL_AFFIRMATIVE_CHOICES
=
((
"
MORE THAN"
,
"MORE THAN"
),
(
"LESS THAN"
,
"LESS THAN"
),
(
"EXACTLY
"
,
"EXACTLY"
),
(
"
AT LEAST"
,
"AT LEAST"
),
(
"AT MOST
"
,
"AT MOST"
))
NUMBER_UNITS_CHOICES
=
((
""
,
""
),
(
"
METERS"
,
"METERS"
),
(
"KILOMETERS"
,
"KILOMETERS"
),
(
"VOLT
"
,
"VOLT"
))
TIME_UNITS_CHOICES
=
((
"
SECONDS"
,
"SECONDS"
),
(
"MINUTES"
,
"MINUTES"
),
(
"MILLISECONDS
"
,
"MILLISECONDS"
))
FLOW_CHOICES
=
get_instances
(
"SAO#Flow"
)
# FLOW returns ()
S2_CHOICES
=
((
"before"
,
"BEFORE"
),
(
"after"
,
"AFTER"
))
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/serializers/main_req.py
View file @
68e6abca
...
...
@@ -3,7 +3,7 @@ from reqman.apps.reqtool.models.main_req import Main
class
MainSerializer
(
serializers
.
ModelSerializer
):
boilerplate_of_main
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
#
boilerplate_of_main = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
:
model
=
Main
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/serializers/requirements.py
View file @
68e6abca
from
rest_framework
import
serializers
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
,
BoilerplateData
class
BoilerplateSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -10,10 +10,16 @@ class BoilerplateSerializer(serializers.ModelSerializer):
class
PrefixSerializer
(
serializers
.
ModelSerializer
):
prefix_boilerplate
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
#
prefix_boilerplate = serializers.PrimaryKeyRelatedField(read_only=True)
prefixgroup
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
:
model
=
Prefix
fields
=
'__all__'
class
BoilerplateDataSerializer
(
serializers
.
ModelSerializer
):
owner_data
=
serializers
.
ReadOnlyField
(
source
=
'owner.username'
)
boilerplate_data_id
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
:
model
=
BoilerplateData
fields
=
'__all__'
reqtool/reqman/api/reqman/apps/reqtool/rest_api/serializers/suffix_req.py
View file @
68e6abca
...
...
@@ -3,7 +3,7 @@ from reqman.apps.reqtool.models.suffix_req import Suffix
class
SuffixSerializer
(
serializers
.
ModelSerializer
):
boilerplate_of_suffix
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
#
boilerplate_of_suffix = serializers.PrimaryKeyRelatedField(read_only=True)
suffix_owner
=
serializers
.
PrimaryKeyRelatedField
(
read_only
=
True
)
class
Meta
:
model
=
Suffix
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/urls.py
View file @
68e6abca
...
...
@@ -9,6 +9,7 @@ urlpatterns = [
path
(
'users/<uuid:pk>/'
,
user_views
.
UserDetail
.
as_view
(),
name
=
'api-post-details'
),
path
(
'boilerplates/'
,
requirements_views
.
BoilerplateListCreateAPIView
.
as_view
(),
name
=
'api-requirements-list'
),
path
(
'boilerplates/<int:pk>/'
,
requirements_views
.
BoilerplateDetailsAPIView
.
as_view
(),
name
=
'api-requirements-details'
),
path
(
'boilerplates/boilerplatedata/'
,
requirements_views
.
BoilerplateDataListAPIView
.
as_view
(),
name
=
'api-boilerlplate-list-data'
),
re_path
(
'boilerplates/(?:title=(?P<title_1>
\
w+)/)?$'
,
requirements_views
.
BoilerplateList
.
as_view
(),
name
=
'api-requirements-details-per-title'
),
#'''Prefix'''
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/main_req_views.py
View file @
68e6abca
...
...
@@ -18,6 +18,8 @@ from reqman.apps.reqtool.models.main_req import SYSTEM_CHOICES, FUNCTION_CHOICES
from
reqman.apps.reqtool.models.main_req
import
STATE_VALUE_CHOICES
,
SHALL_CHOICES
,
VERB_CHOICES
,
QUANTIFIER_CHOICES
,
NUMBER_UNITS_CHOICES
from
reqman.apps.reqtool.models.main_req
import
FLOW_CHOICES
,
CONNECTION_CHOICES
,
STATE_SET_CHOICES
from
reqman.apps.reqtool.models.requirements
import
BoilerplateData
class
MainListAPIView
(
ListAPIView
):
"""
API view to retrieve list of posts or create new
...
...
@@ -56,6 +58,10 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when PUT
def
perform_update
(
self
,
serializer
):
instance
=
serializer
.
validated_data
#add data in thn Model BoilerplateData
mn
=
(
instance
[
'sys_fun_inter'
]
+
' '
+
instance
[
'shall'
]
+
' '
+
instance
[
'verb'
]
+
' '
+
instance
[
'flow_function_interface_item_system_state_stateset'
])
BoilerplateData
.
objects
.
filter
(
owner_data
=
instance
[
'boilerplate_of_main'
]
.
owner
,
boilerplate_data_id
=
instance
[
'boilerplate_of_main'
])
.
update
(
main_data
=
mn
)
serializer
.
save
()
#print(self.new.changed_data)
#instance = serializer.save()
...
...
@@ -64,7 +70,7 @@ class MainDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE
def
perform_destroy
(
self
,
instance
):
#
print("deleted")
#
instance = serializer.validated_data
instance
.
delete
()
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/requirements_views.py
View file @
68e6abca
...
...
@@ -8,12 +8,13 @@ from rest_framework.parsers import JSONParser
from
reqman.apps.reqtool.models.requirements
import
Prefix
,
Boilerplate
,
PREFIX_CHOICES
,
LOGIC_CONNECTIVE
,
VERB_CHOICES
from
reqman.apps.reqtool.models.requirements
import
VERB_CHOICES
,
ITEM_CHOICES
,
SYSTEM_CHOICES
,
FUNCTION_CHOICES
,
STATE_CHOICES
from
reqman.apps.reqtool.models.requirements
import
ITEM_CHOICES
,
FLOW_CHOICES
,
FUNCTION_CHOICES
,
STATE_VALUE_CHOICES
from
reqman.apps.reqtool.rest_api.serializers.requirements
import
PrefixSerializer
,
Boilerplate
Serializer
from
reqman.apps.reqtool.rest_api.serializers.requirements
import
BoilerplateSerializer
,
PrefixSerializer
,
BoilerplateData
Serializer
from
reqman.apps.permissions
import
IsOwnerOrReadOnly
from
reqman.apps.reqtool.rest_api.services
import
fuseki
from
rest_framework.response
import
Response
from
rest_framework.views
import
APIView
from
reqman.apps.reqtool.models.requirements
import
BoilerplateData
from
django.shortcuts
import
get_object_or_404
class
BoilerplateListCreateAPIView
(
ListCreateAPIView
):
...
...
@@ -117,20 +118,35 @@ class PrefixDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when PUT
def
perform_update
(
self
,
serializer
):
#print(self.new.changed_data)
instance
=
serializer
.
validated_data
#add data in thn Model BoilerplateData
pr
=
(
instance
[
'prefix'
]
+
' '
+
instance
[
'system_fun_item'
]
+
' '
+
instance
[
'state_or_verb'
]
+
' '
+
instance
[
'item_function_flow_statevalue'
])
BoilerplateData
.
objects
.
filter
(
owner_data
=
instance
[
'prefix_boilerplate'
]
.
owner
,
boilerplate_data_id
=
instance
[
'prefix_boilerplate'
])
.
update
(
prefix_data
=
pr
)
sprefix
=
self
.
simple_prefix
(
instance
[
"prefix"
])
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
serializer
.
save
(
simple_prefix
=
sprefix
)
#Custom actions when DELETE
def
perform_destroy
(
self
,
instance
):
instance
=
serializer
.
validated_data
#print("deleted")
instance
.
delete
()
class
BoilerplateDataListAPIView
(
ListAPIView
):
"""
API view to retrieve list of posts or create new
"""
permission_classes
=
[
permissions
.
IsAuthenticatedOrReadOnly
]
serializer_class
=
BoilerplateDataSerializer
#queryset = Prefix.objects.all()
def
get_queryset
(
self
):
#print(title)
queryset_boil_data
=
BoilerplateData
.
objects
.
filter
(
owner_data
=
self
.
request
.
user
)
return
queryset_boil_data
class
PrefixChoicesViewSet
(
APIView
):
def
get
(
self
,
request
):
...
...
reqtool/reqman/api/reqman/apps/reqtool/rest_api/views/suffix_req_views.py
View file @
68e6abca
...
...
@@ -15,6 +15,7 @@ from rest_framework.response import Response
from
rest_framework.views
import
APIView
from
reqman.apps.reqtool.models.suffix_req
import
S_CHOICES
,
NUMBER_UNITS_CHOICES
,
TIME_UNITS_CHOICES
,
FLOW_CHOICES
from
reqman.apps.reqtool.models.requirements
import
BoilerplateData
class
SuffixListAPIView
(
ListAPIView
):
...
...
@@ -55,6 +56,10 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when PUT
def
perform_update
(
self
,
serializer
):
instance
=
serializer
.
validated_data
#add data in thn Model BoilerplateData
sf
=
(
instance
[
's_choices'
]
+
' '
+
str
(
instance
[
'numerical'
])
+
' '
+
instance
[
'mumerical_units'
]
+
' '
+
instance
[
'flow'
])
BoilerplateData
.
objects
.
filter
(
owner_data
=
instance
[
'boilerplate_of_suffix'
]
.
owner
,
boilerplate_data_id
=
instance
[
'boilerplate_of_suffix'
])
.
update
(
suffix_data
=
sf
)
serializer
.
save
()
#print(self.new.changed_data)
#instance = serializer.save()
...
...
@@ -63,6 +68,8 @@ class SuffixDetailsAPIView(RetrieveUpdateDestroyAPIView):
#Custom actions when DELETE
def
perform_destroy
(
self
,
instance
):
instance
=
serializer
.
validated_data
#add data in thn Model BoilerplateData
#print("deleted")
instance
.
delete
()
...
...
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