(
self,
env,
id,
name_i18n,
label_i18n=None,
filename=None,
hidden=None,
protected=None,
child_config=None,
attachment_config=None,
pagination_config=None,
fields=None,
primary_field=None,
parent=None,
)
| 232 | |
| 233 | class DataModel: |
| 234 | def __init__( |
| 235 | self, |
| 236 | env, |
| 237 | id, |
| 238 | name_i18n, |
| 239 | label_i18n=None, |
| 240 | filename=None, |
| 241 | hidden=None, |
| 242 | protected=None, |
| 243 | child_config=None, |
| 244 | attachment_config=None, |
| 245 | pagination_config=None, |
| 246 | fields=None, |
| 247 | primary_field=None, |
| 248 | parent=None, |
| 249 | ): |
| 250 | self.env = env |
| 251 | self.filename = filename |
| 252 | self.id = id |
| 253 | self.name_i18n = name_i18n |
| 254 | self.label_i18n = label_i18n |
| 255 | if hidden is None: |
| 256 | hidden = False |
| 257 | self.hidden = hidden |
| 258 | if protected is None: |
| 259 | protected = False |
| 260 | self.protected = protected |
| 261 | if child_config is None: |
| 262 | child_config = ChildConfig() |
| 263 | self.child_config = child_config |
| 264 | if attachment_config is None: |
| 265 | attachment_config = AttachmentConfig() |
| 266 | self.attachment_config = attachment_config |
| 267 | if pagination_config is None: |
| 268 | pagination_config = PaginationConfig(env) |
| 269 | self.pagination_config = pagination_config |
| 270 | if fields is None: |
| 271 | fields = [] |
| 272 | self.fields = fields |
| 273 | if primary_field is None and fields: |
| 274 | primary_field = fields[0].name |
| 275 | self.primary_field = primary_field |
| 276 | self.parent = parent |
| 277 | |
| 278 | # This is a mapping of the key names to the actual field which |
| 279 | # also includes the system fields. This is primarily used for |
| 280 | # fast internal operations but also the admin. |
| 281 | self.field_map = dict((x.name, x) for x in fields) |
| 282 | for key, (ty, opts) in system_fields.items(): |
| 283 | self.field_map[key] = Field(env, name=key, type=ty, options=opts) |
| 284 | |
| 285 | self._child_slug_tmpl = None |
| 286 | self._child_replacements = None |
| 287 | self._label_tmpls = {} |
| 288 | |
| 289 | @property |
| 290 | def name(self): |
nothing calls this directly
no test coverage detected