|
|
|
|
86
|
raise ContentStatusNotExist()
|
86
|
raise ContentStatusNotExist()
|
87
|
|
87
|
|
88
|
def allowed_slugs_values(self) -> typing.List[str]:
|
88
|
def allowed_slugs_values(self) -> typing.List[str]:
|
|
|
89
|
+ """ Get alls slugs"""
|
89
|
return [item.slug for item in self._content_status]
|
90
|
return [item.slug for item in self._content_status]
|
90
|
|
91
|
|
91
|
def allowed(self) -> typing.List[ContentStatus]:
|
92
|
def allowed(self) -> typing.List[ContentStatus]:
|
|
|
93
|
+ """ Get all status"""
|
92
|
return [item for item in self._content_status]
|
94
|
return [item for item in self._content_status]
|
93
|
|
95
|
|
94
|
def get_default_status(self) -> ContentStatus:
|
96
|
def get_default_status(self) -> ContentStatus:
|
|
|
|
|
216
|
self._special_contents_types = [self.Comment]
|
218
|
self._special_contents_types = [self.Comment]
|
217
|
self._extra_slugs = [self.Any_SLUG]
|
219
|
self._extra_slugs = [self.Any_SLUG]
|
218
|
|
220
|
|
219
|
- def get_one_by_slug(self, slug: str):
|
|
|
|
|
221
|
+ def get_one_by_slug(self, slug: str) -> ContentType:
|
|
|
222
|
+ """
|
|
|
223
|
+ Get ContentType object according to slug
|
|
|
224
|
+ match for both slug and slug_alias
|
|
|
225
|
+ """
|
220
|
content_types = self._content_types.copy()
|
226
|
content_types = self._content_types.copy()
|
221
|
content_types.extend(self._special_contents_types)
|
227
|
content_types.extend(self._special_contents_types)
|
222
|
for item in content_types:
|
228
|
for item in content_types:
|
|
|
|
|
225
|
raise ContentTypeNotExist()
|
231
|
raise ContentTypeNotExist()
|
226
|
|
232
|
|
227
|
def endpoint_allowed_types_slug(self) -> typing.List[str]:
|
233
|
def endpoint_allowed_types_slug(self) -> typing.List[str]:
|
|
|
234
|
+ """
|
|
|
235
|
+ Return restricted list of content_type:
|
|
|
236
|
+ dont return special content_type like comment, don't return
|
|
|
237
|
+ "any" slug, dont return content type slug alias , don't return event.
|
|
|
238
|
+ Useful to restrict slug param in schema.
|
|
|
239
|
+ """
|
228
|
allowed_type_slug = [contents_type.slug for contents_type in self._content_types] # nopep8
|
240
|
allowed_type_slug = [contents_type.slug for contents_type in self._content_types] # nopep8
|
229
|
return allowed_type_slug
|
241
|
return allowed_type_slug
|
230
|
|
242
|
|
231
|
def query_allowed_types_slugs(self) -> typing.List[str]:
|
243
|
def query_allowed_types_slugs(self) -> typing.List[str]:
|
|
|
244
|
+ """
|
|
|
245
|
+ Return alls allowed types slug : content_type slug + all alias, any
|
|
|
246
|
+ and special content_type like comment. Do not return event.
|
|
|
247
|
+ Usefull allowed value to perform query to database.
|
|
|
248
|
+ """
|
232
|
allowed_types_slug = []
|
249
|
allowed_types_slug = []
|
233
|
for content_type in self._content_types:
|
250
|
for content_type in self._content_types:
|
234
|
allowed_types_slug.append(content_type.slug)
|
251
|
allowed_types_slug.append(content_type.slug)
|