mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 19:06:55 +00:00
26 lines
773 B
Python
26 lines
773 B
Python
|
from mongoengine import Document, EmbeddedDocument, EmbeddedDocumentField, StringField, Q
|
||
|
|
||
|
from database import Database, strict
|
||
|
from database.fields import StrippedStringField
|
||
|
from database.model import DbModelMixin
|
||
|
|
||
|
|
||
|
class CompanyDefaults(EmbeddedDocument):
|
||
|
cluster = StringField()
|
||
|
|
||
|
|
||
|
class Company(DbModelMixin, Document):
|
||
|
meta = {
|
||
|
'db_alias': Database.backend,
|
||
|
'strict': strict,
|
||
|
}
|
||
|
|
||
|
id = StringField(primary_key=True)
|
||
|
name = StrippedStringField(unique=True, min_length=3)
|
||
|
defaults = EmbeddedDocumentField(CompanyDefaults)
|
||
|
|
||
|
@classmethod
|
||
|
def _prepare_perm_query(cls, company, allow_public=False):
|
||
|
""" Override default behavior since a 'company' constraint is not supported for this document... """
|
||
|
return Q()
|