Skip to content
Snippets Groups Projects
Commit b187fb6b authored by Jaden Diefenbaugh's avatar Jaden Diefenbaugh
Browse files

revert model & serializer changes, will save groups in content instead

parent 27ebfbdd
No related branches found
No related tags found
1 merge request!223Reports overhaul
...@@ -334,13 +334,3 @@ class Report(models.Model): ...@@ -334,13 +334,3 @@ class Report(models.Model):
alias_list = map(lambda x: report_content["alias_experiments"][x], experiments_list) alias_list = map(lambda x: report_content["alias_experiments"][x], experiments_list)
return experiments_list, alias_list return experiments_list, alias_list
#----------------------------------------------------------
class Group(models.Model):
#_____ Fields __________
name = models.CharField(max_length=200, blank=False)
experiments = models.ManyToManyField(Experiment, related_name='groups', blank=True)
report = models.ForeignKey(Report, related_name='groups', blank=True, on_delete=models.CASCADE)
...@@ -53,7 +53,6 @@ class BasicReportSerializer(serializers.ModelSerializer): ...@@ -53,7 +53,6 @@ class BasicReportSerializer(serializers.ModelSerializer):
analyzer = serializers.SerializerMethodField() analyzer = serializers.SerializerMethodField()
html_description = serializers.SerializerMethodField() html_description = serializers.SerializerMethodField()
add_url = serializers.SerializerMethodField() add_url = serializers.SerializerMethodField()
groups = serializers.SerializerMethodField()
class Meta: class Meta:
model = Report model = Report
...@@ -102,16 +101,6 @@ class BasicReportSerializer(serializers.ModelSerializer): ...@@ -102,16 +101,6 @@ class BasicReportSerializer(serializers.ModelSerializer):
def get_add_url(self, obj): def get_add_url(self, obj):
return obj.get_api_add_url() return obj.get_api_add_url()
def get_groups(self, obj):
groups = dict()
for g in groups:
exps = list()
for e in g.experiments:
exps.append(e.name)
groups[g.name] = exps
return groups
#---------------------------------------------------------- #----------------------------------------------------------
...@@ -129,7 +118,7 @@ class FullReportSerializer(BasicReportSerializer): ...@@ -129,7 +118,7 @@ class FullReportSerializer(BasicReportSerializer):
class Meta(BasicReportSerializer.Meta): class Meta(BasicReportSerializer.Meta):
fields = ['name', 'number', 'short_description', 'description', 'is_owner', 'author','status', 'creation_date', 'publication_date', 'experiments', 'analyzer', 'content', 'html_description', 'groups'] fields = ['name', 'number', 'short_description', 'description', 'is_owner', 'author','status', 'creation_date', 'publication_date', 'experiments', 'analyzer', 'content', 'html_description']
#---------------------------------------------------------- #----------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment