Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(sites): simplified create method #179

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Watcher/Watcher/site_monitoring/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@

# Site Serializer
class SiteSerializer(serializers.ModelSerializer):

def create(self, validated_data):
site = Site.objects.create(**validated_data)
site = super().create(validated_data)
monitoring_init(site)
site = Site.objects.get(pk=site.pk)
return site

class Meta:
Expand Down Expand Up @@ -99,4 +97,4 @@ def save(self):
def data(self):
# just return success dictionary. you can change this to your need, but i dont think output should be user data after password change
site_id = self.validated_data['id']
return {'id': site_id, 'misp_event_id': Site.objects.get(pk=site_id).misp_event_id}
return {'id': site_id, 'misp_event_id': Site.objects.get(pk=site_id).misp_event_id}