MCPcopy Create free account
hub / github.com/intelowlproject/IntelOwl / create

Method create

api_app/queryset.py:127–145  ·  view source on GitHub ↗

Creates and saves an object, ensuring its `clean` method is called. Args: **kwargs: The fields to set on the created object. Returns: The created object.

(self, **kwargs)

Source from the content-addressed store, hash-verified

125 """
126
127 def create(self, **kwargs):
128 """
129 Creates and saves an object, ensuring its `clean` method is called.
130
131 Args:
132 **kwargs: The fields to set on the created object.
133
134 Returns:
135 The created object.
136 """
137 obj = self.model(**kwargs)
138 obj: models.Model
139 # we are forcing the clean method call.
140 # django rest framework DOES NOT do that by default,
141 # and I want to be sure that it is actually caled
142 obj.clean()
143 self._for_write = True
144 obj.save(force_insert=True, using=self.db)
145 return obj
146
147 def many_to_many_to_array(self, field: str, field_to_save: str = None):
148 """

Callers

nothing calls this directly

Calls 2

cleanMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected