Commit d8af2e11 authored by Thodoris Nestoridis's avatar Thodoris Nestoridis

add M5-M16 (need explanation on M11,M12,M13)

parent 60f5e7fa
...@@ -24,7 +24,8 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quant ...@@ -24,7 +24,8 @@ MAIN_CHOICES = ( ("",""), ("M1", "M1 : system/function shall [not] set [<quant
) )
#to be updated with domains from DSO #to be updated with domains from DSO
SYSTEM_OR_FUNCTION_CHOICES = (("SYSTEM", "SYSTEM"), ("FUNCTION", "FUNCTION")) SYSTEM_CHOICES = (("SYSTEM", "SYSTEM"), ("SYSTEM2", "SYSTEM2"))
FUNCTION_CHOICES = (("FUNCTION", "FUNCTION"), ("FUNCTION2", "FUNCTION2"))
SHALL_CHOICES = ( ("shall", "SHALL"), ("shall not", "SHALL NOT")) SHALL_CHOICES = ( ("shall", "SHALL"), ("shall not", "SHALL NOT"))
QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"), QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
("more than", "MORE THAN"), ("less than", "LESS THAN"), ("exactly","EXACTLY"), ("more than", "MORE THAN"), ("less than", "LESS THAN"), ("exactly","EXACTLY"),
...@@ -32,7 +33,15 @@ QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"), ...@@ -32,7 +33,15 @@ QUANTIFIER_CHOICES = ( ("none","NONE"), ("all", "ALL"), ("only", "ONLY"),
) )
NUMBER_UNITS_CHOICES = (("",""), ("meters","METERS"), ("kilometers","KILOMETERS"), ("volt","VOLT")) NUMBER_UNITS_CHOICES = (("",""), ("meters","METERS"), ("kilometers","KILOMETERS"), ("volt","VOLT"))
ITEM_CHOICES = (("ITEM", "ITEM"), ("ITEM2", "ITEM2") ) ITEM_CHOICES = (("ITEM", "ITEM"), ("ITEM2", "ITEM2") )
STATE_CHOICES = (("state", "STATE"), ("state2", "STATE2"))
STATE_VALUE_CHOICES = (("enabled", "ENABLED"), ("disabled", "DISABLED")) STATE_VALUE_CHOICES = (("enabled", "ENABLED"), ("disabled", "DISABLED"))
FLOW_CHOICES = (("flow","FLOW"), ("flow2","FLOW2"))
INTERFACE_CHOICES = (("interface","INTERFACE"), ("interface2","INTERFACE2"))
CONNECTION_CHOICES = (("connection","CONNECTION"), ("connection2","CONNECTION2"))
SYSTEM_INTERFACE_CHOICES = SYSTEM_CHOICES + INTERFACE_CHOICES
FLOW_ITEM_CHOICES = FLOW_CHOICES + ITEM_CHOICES
SYSTEM_OR_FUNCTION_CHOICES = SYSTEM_CHOICES + FUNCTION_CHOICES
def create_main(instance): def create_main(instance):
...@@ -113,6 +122,197 @@ def create_m4(instance, now_main, prev_main): ...@@ -113,6 +122,197 @@ def create_m4(instance, now_main, prev_main):
main.save() main.save()
def create_m5(instance, now_main, prev_main):
try :
main = Main_M5.objects.get(main_owner_of_m5 = instance, boilerplate_of_m5 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M5.objects.get(main_owner_of_m5 = instance, boilerplate_of_m5 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[5][0]:
main = Main_M5(main_owner_of_m5 = instance, boilerplate_of_m5 = instance.boilerplate_of_main)
main.save()
except Main_M5.DoesNotExist:
if now_main == MAIN_CHOICES[5][0]:
main = Main_M5(main_owner_of_m5 = instance, boilerplate_of_m5 = instance.boilerplate_of_main)
main.save()
def create_m6(instance, now_main, prev_main):
try :
main = Main_M6.objects.get(main_owner_of_m6 = instance, boilerplate_of_m6 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M6.objects.get(main_owner_of_m6 = instance, boilerplate_of_m6 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[6][0]:
main = Main_M6(main_owner_of_m6 = instance, boilerplate_of_m6 = instance.boilerplate_of_main)
main.save()
except Main_M6.DoesNotExist:
if now_main == MAIN_CHOICES[6][0]:
main = Main_M6(main_owner_of_m6 = instance, boilerplate_of_m6 = instance.boilerplate_of_main)
main.save()
def create_m7(instance, now_main, prev_main):
try :
main = Main_M7.objects.get(main_owner_of_m7 = instance, boilerplate_of_m7 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M7.objects.get(main_owner_of_m7 = instance, boilerplate_of_m7 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[7][0]:
main = Main_M7(main_owner_of_m7 = instance, boilerplate_of_m7 = instance.boilerplate_of_main)
main.save()
except Main_M7.DoesNotExist:
if now_main == MAIN_CHOICES[7][0]:
main = Main_M7(main_owner_of_m7 = instance, boilerplate_of_m7 = instance.boilerplate_of_main)
main.save()
def create_m8(instance, now_main, prev_main):
try :
main = Main_M8.objects.get(main_owner_of_m8 = instance, boilerplate_of_m8 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M8.objects.get(main_owner_of_m8 = instance, boilerplate_of_m8 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[8][0]:
main = Main_M8(main_owner_of_m8 = instance, boilerplate_of_m8 = instance.boilerplate_of_main)
main.save()
except Main_M8.DoesNotExist:
if now_main == MAIN_CHOICES[8][0]:
main = Main_M8(main_owner_of_m8 = instance, boilerplate_of_m8 = instance.boilerplate_of_main)
main.save()
def create_m9(instance, now_main, prev_main):
try :
main = Main_M9.objects.get(main_owner_of_m9 = instance, boilerplate_of_m9 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M9.objects.get(main_owner_of_m9 = instance, boilerplate_of_m9 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[9][0]:
main = Main_M9(main_owner_of_m9 = instance, boilerplate_of_m9 = instance.boilerplate_of_main)
main.save()
except Main_M9.DoesNotExist:
if now_main == MAIN_CHOICES[9][0]:
main = Main_M9(main_owner_of_m9 = instance, boilerplate_of_m9 = instance.boilerplate_of_main)
main.save()
def create_m10(instance, now_main, prev_main):
try :
main = Main_M10.objects.get(main_owner_of_m10 = instance, boilerplate_of_m10 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M10.objects.get(main_owner_of_m10 = instance, boilerplate_of_m10 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[10][0]:
main = Main_M10(main_owner_of_m10 = instance, boilerplate_of_m10 = instance.boilerplate_of_main)
main.save()
except Main_M10.DoesNotExist:
if now_main == MAIN_CHOICES[10][0]:
main = Main_M10(main_owner_of_m10 = instance, boilerplate_of_m10 = instance.boilerplate_of_main)
main.save()
def create_m11(instance, now_main, prev_main):
try :
main = Main_M11.objects.get(main_owner_of_m11 = instance, boilerplate_of_m11 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M11.objects.get(main_owner_of_m11 = instance, boilerplate_of_m11 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[11][0]:
main = Main_M11(main_owner_of_m11 = instance, boilerplate_of_m11 = instance.boilerplate_of_main)
main.save()
except Main_M11.DoesNotExist:
if now_main == MAIN_CHOICES[11][0]:
main = Main_M11(main_owner_of_m11 = instance, boilerplate_of_m11 = instance.boilerplate_of_main)
main.save()
def create_m12(instance, now_main, prev_main):
try :
main = Main_M12.objects.get(main_owner_of_m12 = instance, boilerplate_of_m12 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M12.objects.get(main_owner_of_m12 = instance, boilerplate_of_m12 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[12][0]:
main = Main_M12(main_owner_of_m12 = instance, boilerplate_of_m12 = instance.boilerplate_of_main)
main.save()
except Main_M12.DoesNotExist:
if now_main == MAIN_CHOICES[12][0]:
main = Main_M12(main_owner_of_m12 = instance, boilerplate_of_m12 = instance.boilerplate_of_main)
main.save()
def create_m13(instance, now_main, prev_main):
try :
main = Main_M13.objects.get(main_owner_of_m13 = instance, boilerplate_of_m13 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M13.objects.get(main_owner_of_m13 = instance, boilerplate_of_m13 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[13][0]:
main = Main_M13(main_owner_of_m13 = instance, boilerplate_of_m13 = instance.boilerplate_of_main)
main.save()
except Main_M13.DoesNotExist:
if now_main == MAIN_CHOICES[13][0]:
main = Main_M13(main_owner_of_m13 = instance, boilerplate_of_m13 = instance.boilerplate_of_main)
main.save()
def create_m14(instance, now_main, prev_main):
try :
main = Main_M14.objects.get(main_owner_of_m14 = instance, boilerplate_of_m14 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M14.objects.get(main_owner_of_m14 = instance, boilerplate_of_m14 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[14][0]:
main = Main_M14(main_owner_of_m14 = instance, boilerplate_of_m14 = instance.boilerplate_of_main)
main.save()
except Main_M14.DoesNotExist:
if now_main == MAIN_CHOICES[14][0]:
main = Main_M14(main_owner_of_m14 = instance, boilerplate_of_m14 = instance.boilerplate_of_main)
main.save()
def create_m15(instance, now_main, prev_main):
try :
main = Main_M15.objects.get(main_owner_of_m15 = instance, boilerplate_of_m15 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M15.objects.get(main_owner_of_m15 = instance, boilerplate_of_m15 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[15][0]:
main = Main_M15(main_owner_of_m15 = instance, boilerplate_of_m15 = instance.boilerplate_of_main)
main.save()
except Main_M15.DoesNotExist:
if now_main == MAIN_CHOICES[15][0]:
main = Main_M15(main_owner_of_m15 = instance, boilerplate_of_m15 = instance.boilerplate_of_main)
main.save()
def create_m16(instance, now_main, prev_main):
try :
main = Main_M16.objects.get(main_owner_of_m16 = instance, boilerplate_of_m16 = instance.boilerplate_of_main)
if now_main == prev_main:
return
main = Main_M16.objects.get(main_owner_of_m16 = instance, boilerplate_of_m16 = instance.boilerplate_of_main)
main.delete()
if now_main == MAIN_CHOICES[16][0]:
main = Main_M16(main_owner_of_m16 = instance, boilerplate_of_m16 = instance.boilerplate_of_main)
main.save()
except Main_M16.DoesNotExist:
if now_main == MAIN_CHOICES[16][0]:
main = Main_M16(main_owner_of_m16 = instance, boilerplate_of_m16 = instance.boilerplate_of_main)
main.save()
class Main(models.Model): class Main(models.Model):
boilerplate_of_main = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate', on_delete=models.CASCADE) boilerplate_of_main = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate', on_delete=models.CASCADE)
...@@ -141,7 +341,20 @@ class Main(models.Model): ...@@ -141,7 +341,20 @@ class Main(models.Model):
create_m2( self, self.main_choices, prev_main_list[0]) create_m2( self, self.main_choices, prev_main_list[0])
create_m3( self, self.main_choices, prev_main_list[0]) create_m3( self, self.main_choices, prev_main_list[0])
create_m4( self, self.main_choices, prev_main_list[0]) create_m4( self, self.main_choices, prev_main_list[0])
create_m5( self, self.main_choices, prev_main_list[0])
create_m6( self, self.main_choices, prev_main_list[0])
create_m7( self, self.main_choices, prev_main_list[0])
create_m8( self, self.main_choices, prev_main_list[0])
create_m9( self, self.main_choices, prev_main_list[0])
create_m10( self, self.main_choices, prev_main_list[0])
create_m11( self, self.main_choices, prev_main_list[0])
create_m12( self, self.main_choices, prev_main_list[0])
create_m13( self, self.main_choices, prev_main_list[0])
create_m14( self, self.main_choices, prev_main_list[0])
create_m15( self, self.main_choices, prev_main_list[0])
create_m16( self, self.main_choices, prev_main_list[0])
class Meta: class Meta:
ordering = ['boilerplate_of_main'] ordering = ['boilerplate_of_main']
...@@ -206,5 +419,142 @@ class Main_M4(models.Model): ...@@ -206,5 +419,142 @@ class Main_M4(models.Model):
ordering = ['boilerplate_of_m4'] ordering = ['boilerplate_of_m4']
class Main_M5(models.Model):
boilerplate_of_m5 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M5', on_delete=models.CASCADE)
main_owner_of_m5 = models.ForeignKey(Main, related_name='main_owner_of_M5', on_delete=models.CASCADE)
sys_fun_m5 = models.CharField(choices=SYSTEM_OR_FUNCTION_CHOICES, max_length=100)
shall_m5 = models.CharField(choices=SHALL_CHOICES, max_length=100)
flow_m5 = models.CharField(choices=FLOW_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m5']
class Main_M6(models.Model):
boilerplate_of_m6 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M6', on_delete=models.CASCADE)
main_owner_of_m6 = models.ForeignKey(Main, related_name='main_owner_of_M6', on_delete=models.CASCADE)
sys_fun_m6 = models.CharField(choices=SYSTEM_OR_FUNCTION_CHOICES, max_length=100)
shall_m6 = models.CharField(choices=SHALL_CHOICES, max_length=100)
flow_m6 = models.CharField(choices=FLOW_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m6']
class Main_M7(models.Model):
boilerplate_of_m7 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M7', on_delete=models.CASCADE)
main_owner_of_m7 = models.ForeignKey(Main, related_name='main_owner_of_M7', on_delete=models.CASCADE)
system_m7 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
shall_m7 = models.CharField(choices=SHALL_CHOICES, max_length=100)
function_m7 = models.CharField(choices=FUNCTION_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m7']
class Main_M8(models.Model):
boilerplate_of_m8 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M8', on_delete=models.CASCADE)
main_owner_of_m8 = models.ForeignKey(Main, related_name='main_owner_of_M8', on_delete=models.CASCADE)
function_1_m8 = models.CharField(choices=FUNCTION_CHOICES, max_length=100)
shall_m8 = models.CharField(choices=SHALL_CHOICES, max_length=100)
function_2_m8 = models.CharField(choices=FUNCTION_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m8']
class Main_M9(models.Model):
boilerplate_of_m9 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M9', on_delete=models.CASCADE)
main_owner_of_m9 = models.ForeignKey(Main, related_name='main_owner_of_M9', on_delete=models.CASCADE)
system_1_m9 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
shall_m9 = models.CharField(choices=SHALL_CHOICES, max_length=100)
interface_m9 = models.CharField(choices=INTERFACE_CHOICES, max_length=100)
system_2_m9 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m9']
class Main_M10(models.Model):
boilerplate_of_m10 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M10', on_delete=models.CASCADE)
main_owner_of_m10 = models.ForeignKey(Main, related_name='main_owner_of_M10', on_delete=models.CASCADE)
sys_inter_m10 = models.CharField(choices=SYSTEM_INTERFACE_CHOICES, max_length=100)
shall_m10 = models.CharField(choices=SHALL_CHOICES, max_length=100)
flow_item_m9 = models.CharField(choices=FLOW_ITEM_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m10']
#need to ask about [as de ned in <text>]
class Main_M11(models.Model):
boilerplate_of_m11 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M11', on_delete=models.CASCADE)
main_owner_of_m11 = models.ForeignKey(Main, related_name='main_owner_of_M11', on_delete=models.CASCADE)
system_1_m11 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
shall_m11 = models.CharField(choices=SHALL_CHOICES, max_length=100)
system_2_m11 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
connection_m11 = models.CharField(choices=CONNECTION_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m11']
#need to ask about [with values stateSet]
class Main_M12(models.Model):
boilerplate_of_m12 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M12', on_delete=models.CASCADE)
main_owner_of_m12 = models.ForeignKey(Main, related_name='main_owner_of_M12', on_delete=models.CASCADE)
system_m12 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
shall_m12 = models.CharField(choices=SHALL_CHOICES, max_length=100)
state_m12 = models.CharField(choices=STATE_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m12']
#need to ask about [with values stateSet]
class Main_M13(models.Model):
boilerplate_of_m13 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M13', on_delete=models.CASCADE)
main_owner_of_m13 = models.ForeignKey(Main, related_name='main_owner_of_M13', on_delete=models.CASCADE)
system_m13 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
state_1_m13 = models.CharField(choices=STATE_CHOICES, max_length=100)
statevalue_m13 = models.CharField(choices=STATE_VALUE_CHOICES, max_length=100)
shall_m13 = models.CharField(choices=SHALL_CHOICES, max_length=100)
state_2_m13 = models.CharField(choices=STATE_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m13']
class Main_M14(models.Model):
boilerplate_of_m14 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M14', on_delete=models.CASCADE)
main_owner_of_m14 = models.ForeignKey(Main, related_name='main_owner_of_M14', on_delete=models.CASCADE)
system_m14 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
item_m14 = models.CharField(choices=ITEM_CHOICES, max_length=100)
shall_m14 = models.CharField(choices=SHALL_CHOICES, max_length=100)
#needs stateSET
class Meta:
ordering = ['boilerplate_of_m14']
class Main_M15(models.Model):
boilerplate_of_m15 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M15', on_delete=models.CASCADE)
main_owner_of_m15 = models.ForeignKey(Main, related_name='main_owner_of_M15', on_delete=models.CASCADE)
system_m15 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
item_1_m15 = models.CharField(choices=ITEM_CHOICES, max_length=100)
shall_m15 = models.CharField(choices=SHALL_CHOICES, max_length=100)
item_2_m15 = models.CharField(choices=ITEM_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m15']
class Main_M16(models.Model):
boilerplate_of_m16 = models.ForeignKey('reqtool.Boilerplate', related_name='main_boilerplate_of_M16', on_delete=models.CASCADE)
main_owner_of_m16 = models.ForeignKey(Main, related_name='main_owner_of_M16', on_delete=models.CASCADE)
system_1_m16 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
shall_m16 = models.CharField(choices=SHALL_CHOICES, max_length=100)
system_2_m16 = models.CharField(choices=SYSTEM_CHOICES, max_length=100)
class Meta:
ordering = ['boilerplate_of_m16']
from rest_framework import serializers from rest_framework import serializers
from reqman.apps.reqtool.models.main_req import Main, Main_M1, Main_M2, Main_M3, Main_M4 from reqman.apps.reqtool.models.main_req import Main, Main_M1, Main_M2, Main_M3, Main_M4
from reqman.apps.reqtool.models.main_req import Main_M5, Main_M6, Main_M7, Main_M8
from reqman.apps.reqtool.models.main_req import Main_M9, Main_M10, Main_M11, Main_M12
from reqman.apps.reqtool.models.main_req import Main_M13, Main_M14, Main_M15, Main_M16
class MainSerializer(serializers.ModelSerializer): class MainSerializer(serializers.ModelSerializer):
boilerplate_of_main = serializers.PrimaryKeyRelatedField(read_only=True) boilerplate_of_main = serializers.PrimaryKeyRelatedField(read_only=True)
...@@ -38,4 +42,104 @@ class Main_M4Serializer(serializers.ModelSerializer): ...@@ -38,4 +42,104 @@ class Main_M4Serializer(serializers.ModelSerializer):
main_owner_of_m4 = serializers.PrimaryKeyRelatedField(read_only=True) main_owner_of_m4 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta: class Meta:
model = Main_M4 model = Main_M4
fields = ( 'id', 'boilerplate_of_m4', 'main_owner_of_m4', 'sys_fun_m4', 'shall_m4', 'quantifier_m4', 'numerical_m4', 'mumerical_units_m4', 'item_m4') fields = ( 'id', 'boilerplate_of_m4', 'main_owner_of_m4', 'sys_fun_m4', 'shall_m4', 'quantifier_m4', 'numerical_m4', 'mumerical_units_m4', 'item_m4')
\ No newline at end of file
class Main_M5Serializer(serializers.ModelSerializer):
boilerplate_of_m5 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m5 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M5
fields = ( 'id', 'boilerplate_of_m5', 'main_owner_of_m5', 'sys_fun_m5', 'shall_m5', 'flow_m5')
class Main_M6Serializer(serializers.ModelSerializer):
boilerplate_of_m6 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m6 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M6
fields = ( 'id', 'boilerplate_of_m6', 'main_owner_of_m6', 'sys_fun_m6', 'shall_m6', 'flow_m6')
class Main_M7Serializer(serializers.ModelSerializer):
boilerplate_of_m7 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m7 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M7
fields = ( 'id', 'boilerplate_of_m7', 'main_owner_of_m7', 'system_m7', 'shall_m7', 'function_m7')
class Main_M8Serializer(serializers.ModelSerializer):
boilerplate_of_m8 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m8 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M8
fields = ( 'id', 'boilerplate_of_m8', 'main_owner_of_m8', 'function_1_m8', 'shall_m8', 'function_2_m8')
class Main_M9Serializer(serializers.ModelSerializer):
boilerplate_of_m9 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m9 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M9
fields = ( 'id', 'boilerplate_of_m9', 'main_owner_of_m9', 'system_1_m9', 'shall_m9', 'interface_m9', 'system_2_m9')
class Main_M10Serializer(serializers.ModelSerializer):
boilerplate_of_m10 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m10 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M10
fields = ( 'id', 'boilerplate_of_m10', 'main_owner_of_m10', 'sys_inter_m10', 'shall_m10', 'flow_item_m9')
class Main_M11Serializer(serializers.ModelSerializer):
boilerplate_of_m11 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m11 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M11
fields = ( 'id', 'boilerplate_of_m11', 'main_owner_of_m11', 'system_1_m11', 'shall_m11', 'system_2_m11', 'connection_m11')
class Main_M12Serializer(serializers.ModelSerializer):
boilerplate_of_m12 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m12 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M12
fields = ( 'id', 'boilerplate_of_m12', 'main_owner_of_m12', 'system_m12', 'shall_m12', 'state_m12')
class Main_M13Serializer(serializers.ModelSerializer):
boilerplate_of_m13 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m13 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M13
fields = ( 'id', 'boilerplate_of_m13', 'main_owner_of_m13', 'system_m13', 'state_1_m13', 'statevalue_m13', 'shall_m13', 'state_2_m13')
class Main_M14Serializer(serializers.ModelSerializer):
boilerplate_of_m14 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m14 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M14
fields = ( 'id', 'boilerplate_of_m14', 'main_owner_of_m14', 'system_m14', 'item_m14', 'shall_m14')
class Main_M15Serializer(serializers.ModelSerializer):
boilerplate_of_m15 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m15 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M15
fields = ( 'id', 'boilerplate_of_m15', 'main_owner_of_m15', 'system_m15', 'item_1_m15', 'shall_m15', 'item_2_m15')
class Main_M16Serializer(serializers.ModelSerializer):
boilerplate_of_m16 = serializers.PrimaryKeyRelatedField(read_only=True)
main_owner_of_m16 = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Main_M16
fields = ( 'id', 'boilerplate_of_m16', 'main_owner_of_m16', 'system_1_m16', 'shall_m16', 'system_2_m16')
...@@ -31,16 +31,52 @@ urlpatterns = [ ...@@ -31,16 +31,52 @@ urlpatterns = [
path('requirements/<int:boilerplate>/main/', main_req_views.MainListCreateAPIView.as_view(), name='api-main-list'), path('requirements/<int:boilerplate>/main/', main_req_views.MainListCreateAPIView.as_view(), name='api-main-list'),
path('requirements/<int:boilerplate>/main/<int:pk>/', main_req_views.MainDetailsAPIView.as_view(), name='api-main-details'), path('requirements/<int:boilerplate>/main/<int:pk>/', main_req_views.MainDetailsAPIView.as_view(), name='api-main-details'),
#'''M1''' #'''M1'''
path('requirements/<int:boilerplate>/main/<int:mains>/m1', main_req_views.Main_M1ListCreateAPIView.as_view(), name='api-main-m1-list'), path('requirements/<int:boilerplate>/main/<int:mains>/m1/', main_req_views.Main_M1ListCreateAPIView.as_view(), name='api-main-m1-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m1/<int:pk>/', main_req_views.Main_M1DetailsAPIView.as_view(), name='api-main-m1-details'), path('requirements/<int:boilerplate>/main/<int:mains>/m1/<int:pk>/', main_req_views.Main_M1DetailsAPIView.as_view(), name='api-main-m1-details'),
#'''M2''' #'''M2'''
path('requirements/<int:boilerplate>/main/<int:mains>/m2', main_req_views.Main_M2ListCreateAPIView.as_view(), name='api-main-m2-list'), path('requirements/<int:boilerplate>/main/<int:mains>/m2/', main_req_views.Main_M2ListCreateAPIView.as_view(), name='api-main-m2-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m2/<int:pk>/', main_req_views.Main_M2DetailsAPIView.as_view(), name='api-main-m2-details'), path('requirements/<int:boilerplate>/main/<int:mains>/m2/<int:pk>/', main_req_views.Main_M2DetailsAPIView.as_view(), name='api-main-m2-details'),
#'''M3''' #'''M3'''
path('requirements/<int:boilerplate>/main/<int:mains>/m3', main_req_views.Main_M3ListCreateAPIView.as_view(), name='api-main-m3-list'), path('requirements/<int:boilerplate>/main/<int:mains>/m3/', main_req_views.Main_M3ListCreateAPIView.as_view(), name='api-main-m3-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m3/<int:pk>/', main_req_views.Main_M3DetailsAPIView.as_view(), name='api-main-m3-details'), path('requirements/<int:boilerplate>/main/<int:mains>/m3/<int:pk>/', main_req_views.Main_M3DetailsAPIView.as_view(), name='api-main-m3-details'),
#'''M4''' #'''M4'''
path('requirements/<int:boilerplate>/main/<int:mains>/m4', main_req_views.Main_M4ListCreateAPIView.as_view(), name='api-main-m4-list'), path('requirements/<int:boilerplate>/main/<int:mains>/m4/', main_req_views.Main_M4ListCreateAPIView.as_view(), name='api-main-m4-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m4/<int:pk>/', main_req_views.Main_M4DetailsAPIView.as_view(), name='api-main-m4-details'), path('requirements/<int:boilerplate>/main/<int:mains>/m4/<int:pk>/', main_req_views.Main_M4DetailsAPIView.as_view(), name='api-main-m4-details'),
#'''M5'''
path('requirements/<int:boilerplate>/main/<int:mains>/m5/', main_req_views.Main_M5ListCreateAPIView.as_view(), name='api-main-m5-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m5/<int:pk>/', main_req_views.Main_M5DetailsAPIView.as_view(), name='api-main-m5-details'),
#'''M6'''
path('requirements/<int:boilerplate>/main/<int:mains>/m6/', main_req_views.Main_M6ListCreateAPIView.as_view(), name='api-main-m6-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m6/<int:pk>/', main_req_views.Main_M6DetailsAPIView.as_view(), name='api-main-m6-details'),
#'''M7'''
path('requirements/<int:boilerplate>/main/<int:mains>/m7/', main_req_views.Main_M7ListCreateAPIView.as_view(), name='api-main-m7-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m7/<int:pk>/', main_req_views.Main_M7DetailsAPIView.as_view(), name='api-main-m7-details'),
#'''M8'''
path('requirements/<int:boilerplate>/main/<int:mains>/m8/', main_req_views.Main_M8ListCreateAPIView.as_view(), name='api-main-m8-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m8/<int:pk>/', main_req_views.Main_M8DetailsAPIView.as_view(), name='api-main-m8-details'),
#'''M9'''
path('requirements/<int:boilerplate>/main/<int:mains>/m9/', main_req_views.Main_M9ListCreateAPIView.as_view(), name='api-main-m9-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m9/<int:pk>/', main_req_views.Main_M9DetailsAPIView.as_view(), name='api-main-m9-details'),
#'''M10'''
path('requirements/<int:boilerplate>/main/<int:mains>/m10/', main_req_views.Main_M10ListCreateAPIView.as_view(), name='api-main-m10-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m10/<int:pk>/', main_req_views.Main_M10DetailsAPIView.as_view(), name='api-main-m10-details'),
#'''M11'''
path('requirements/<int:boilerplate>/main/<int:mains>/m11/', main_req_views.Main_M11ListCreateAPIView.as_view(), name='api-main-m11-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m11/<int:pk>/', main_req_views.Main_M11DetailsAPIView.as_view(), name='api-main-m11-details'),
#'''M12'''
path('requirements/<int:boilerplate>/main/<int:mains>/m12/', main_req_views.Main_M12ListCreateAPIView.as_view(), name='api-main-m12-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m12/<int:pk>/', main_req_views.Main_M12DetailsAPIView.as_view(), name='api-main-m12-details'),
#'''M13'''
path('requirements/<int:boilerplate>/main/<int:mains>/m13/', main_req_views.Main_M13ListCreateAPIView.as_view(), name='api-main-m13-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m13/<int:pk>/', main_req_views.Main_M13DetailsAPIView.as_view(), name='api-main-m13-details'),
#'''M14'''
path('requirements/<int:boilerplate>/main/<int:mains>/m14/', main_req_views.Main_M14ListCreateAPIView.as_view(), name='api-main-m14-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m14/<int:pk>/', main_req_views.Main_M14DetailsAPIView.as_view(), name='api-main-m14-details'),
#'''M15'''
path('requirements/<int:boilerplate>/main/<int:mains>/m15/', main_req_views.Main_M15ListCreateAPIView.as_view(), name='api-main-m15-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m15/<int:pk>/', main_req_views.Main_M15DetailsAPIView.as_view(), name='api-main-m15-details'),
#'''M16'''
path('requirements/<int:boilerplate>/main/<int:mains>/m16/', main_req_views.Main_M16ListCreateAPIView.as_view(), name='api-main-m16-list'),
path('requirements/<int:boilerplate>/main/<int:mains>/m16/<int:pk>/', main_req_views.Main_M16DetailsAPIView.as_view(), name='api-main-m16-details'),
] ]
\ No newline at end of file
...@@ -6,7 +6,15 @@ from django.views.decorators.csrf import csrf_exempt ...@@ -6,7 +6,15 @@ from django.views.decorators.csrf import csrf_exempt
from rest_framework.parsers import JSONParser from rest_framework.parsers import JSONParser
from reqman.apps.reqtool.models.main_req import Main, Main_M1, Main_M2, Main_M3, Main_M4 from reqman.apps.reqtool.models.main_req import Main, Main_M1, Main_M2, Main_M3, Main_M4
from reqman.apps.reqtool.models.main_req import Main_M5, Main_M6, Main_M7, Main_M8
from reqman.apps.reqtool.models.main_req import Main_M9, Main_M10, Main_M11, Main_M12
from reqman.apps.reqtool.models.main_req import Main_M13, Main_M14, Main_M15, Main_M16
from reqman.apps.reqtool.rest_api.serializers.main_req import MainSerializer, Main_M1Serializer, Main_M2Serializer, Main_M3Serializer, Main_M4Serializer from reqman.apps.reqtool.rest_api.serializers.main_req import MainSerializer, Main_M1Serializer, Main_M2Serializer, Main_M3Serializer, Main_M4Serializer
from reqman.apps.reqtool.rest_api.serializers.main_req import Main_M5Serializer, Main_M6Serializer, Main_M7Serializer, Main_M8Serializer
from reqman.apps.reqtool.rest_api.serializers.main_req import Main_M9Serializer, Main_M10Serializer, Main_M11Serializer, Main_M12Serializer
from reqman.apps.reqtool.rest_api.serializers.main_req import Main_M13Serializer, Main_M14Serializer, Main_M15Serializer, Main_M16Serializer
from reqman.apps.permissions import IsOwnerOrReadOnly from reqman.apps.permissions import IsOwnerOrReadOnly
from reqman.apps.reqtool.rest_api.services import fuseki from reqman.apps.reqtool.rest_api.services import fuseki
...@@ -256,6 +264,591 @@ class Main_M4DetailsAPIView(RetrieveUpdateDestroyAPIView): ...@@ -256,6 +264,591 @@ class Main_M4DetailsAPIView(RetrieveUpdateDestroyAPIView):
instance.delete() instance.delete()
class Main_M5ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M5Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M5.objects.filter(boilerplate_of_m5 = bp, main_owner_of_m5 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M5DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M5Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M5.objects.filter(boilerplate_of_m5 = bp, main_owner_of_m5 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M6ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M6Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M6.objects.filter(boilerplate_of_m6 = bp, main_owner_of_m6 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M6DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M6Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M6.objects.filter(boilerplate_of_m6 = bp, main_owner_of_m6 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M7ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M7Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M7.objects.filter(boilerplate_of_m7 = bp, main_owner_of_m7 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M7DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M7Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M7.objects.filter(boilerplate_of_m7 = bp, main_owner_of_m7 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M8ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M8Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M8.objects.filter(boilerplate_of_m8 = bp, main_owner_of_m8 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M8DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M8Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M8.objects.filter(boilerplate_of_m8 = bp, main_owner_of_m8 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M9ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M9Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M9.objects.filter(boilerplate_of_m9 = bp, main_owner_of_m9 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M9DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M9Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M9.objects.filter(boilerplate_of_m9 = bp, main_owner_of_m9 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M10ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M10Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M10.objects.filter(boilerplate_of_m10 = bp, main_owner_of_m10 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M10DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M10Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M10.objects.filter(boilerplate_of_m10 = bp, main_owner_of_m10 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M11ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M11Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M11.objects.filter(boilerplate_of_m11 = bp, main_owner_of_m11 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M11DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M11Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M11.objects.filter(boilerplate_of_m11 = bp, main_owner_of_m11 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M12ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M12Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M12.objects.filter(boilerplate_of_m12 = bp, main_owner_of_m12 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M12DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M12Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M12.objects.filter(boilerplate_of_m12 = bp, main_owner_of_m12 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M13ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M13Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M13.objects.filter(boilerplate_of_m13 = bp, main_owner_of_m13 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M13DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M13Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M13.objects.filter(boilerplate_of_m13 = bp, main_owner_of_m13 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M14ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M14Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M14.objects.filter(boilerplate_of_m14 = bp, main_owner_of_m14 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M14DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M14Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M14.objects.filter(boilerplate_of_m14 = bp, main_owner_of_m14 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M15ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M15Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M15.objects.filter(boilerplate_of_m15 = bp, main_owner_of_m15 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M15DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M15Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M15.objects.filter(boilerplate_of_m15 = bp, main_owner_of_m15 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
class Main_M16ListCreateAPIView(ListCreateAPIView):
"""
API view to retrieve list of posts or create new
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M16Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M16.objects.filter(boilerplate_of_m16 = bp, main_owner_of_m16 = mn)
return queryset_main
#Custom actions when POST
def perform_create(self, serializer):
serializer.save()
#print the data of the post
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
class Main_M16DetailsAPIView(RetrieveUpdateDestroyAPIView):
"""
API view to retrieve, update or delete post
"""
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
serializer_class = Main_M16Serializer
def get_queryset(self):
bp = self.kwargs['boilerplate']
mn = self.kwargs['mains']
#print(group_pk)
queryset_main = Main_M16.objects.filter(boilerplate_of_m16 = bp, main_owner_of_m16 = mn)
return queryset_main
#Custom actions when PUT
def perform_update(self, serializer):
serializer.save()
#print(self.new.changed_data)
#instance = serializer.save()
#write_fuseki = fuseki.FusekiActions()
#write_fuseki.write(serializer.data)
#Custom actions when DELETE
def perform_destroy(self, instance):
#print("deleted")
instance.delete()
Markdown is supported
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