class TENANT(MongoModel): name = CharField() logo = ObjectIdField() remark = CharField() resources = ListField(blank=True) delete = BooleanField() activated = BooleanField() namespace = CharField() createdAt = DateTimeField() updatedAt = DateTimeField() class Meta: collection_name = 'tenant' final = True
class CERTIFICATION(MongoModel): certification = CharField() delete = BooleanField() class Meta: collection_name = 'certification' final = True
class CATEGORY(MongoModel): name = CharField() delete = BooleanField() class Meta: collection_name = 'category' final = True
class State(MongoModel): state_name = CharField(verbose_name="Name of State", primary_key=True, required=True) class Meta: write_concern = WriteConcern(j=True) connection_alias = LOCAL_DB_ALIAS
class TYPE(MongoModel): name = CharField() category = ReferenceField(CATEGORY) delete = BooleanField() class Meta: collection_name = 'type' final = True
class CUSTOM(MongoModel): tenant = ReferenceError(TENANT) name = CharField() logo = ListField() background = CharField() remark = CharField() description = CharField() characteristic = ListField() introduction = ListField() tags = ListField() connect = DictField() createdAt = DateTimeField() updatedAt = DateTimeField() delete = BooleanField() class Meta: collection_name = 'custom' final = True
class County(MongoModel): county_name = CharField(verbose_name="Name of county", primary_key=True) parent_state = ReferenceField(State, verbose_name="States county belongs to", required=True) election_office = EmbeddedDocumentField( ElectionOffice, verbose_name="County election office information") class Meta: write_concern = WriteConcern(j=True) connection_alias = LOCAL_DB_ALIAS
class City(MongoModel): city_name = CharField(verbose_name="Name of city", primary_key=True, required=True) parent_county = ReferenceField(County, verbose_name="County city belongs to", required=True) election_office = ReferenceField( ElectionOffice, verbose_name="City election office information") class Meta: write_concern = WriteConcern(j=True) connection_alias = LOCAL_DB_ALIAS
class PhysicalAddress(EmbeddedMongoModel): state = CharField(verbose_name="Name of state", required=True) city = CharField(verbose_name="Name of city", required=True) zip_code = CharField(verbose_name="Name of zip code", min_length=5, max_length=5, required=True) location_name = CharField(verbose_name="Name of election office", required=True) street = CharField(verbose_name="Name of street", required=True) apt_unit = CharField(verbose_name="Apartment or unit number") po_box = CharField(verbose_name="Name of PO Box")
class ZipCode(MongoModel): zip_code = CharField( verbose_name="Zip Code", primary_key=True, min_length=5, max_length=5, required=True, ) parent_city = ReferenceField(City, verbose_name="City zip code belongs to", required=True) class Meta: write_concern = WriteConcern(j=True) connection_alias = LOCAL_DB_ALIAS
class PROJECT(MongoModel): creator = ObjectIdField() title = CharField() description = CharField() requirement = CharField() material = CharField() reference = CharField() tag = ReferenceField(TYPE) image = CharField() labs = ListField() timeConsume = CharField() base = ReferenceField('PROJECT', blank=True) # base = ReferenceField('PROJECT') spec = CharField() delete = BooleanField() createdAt = DateTimeField() updatedAt = DateTimeField() class Meta: collection_name = 'project' final = True
class ElectionOffice(EmbeddedMongoModel): county_name = CharField(verbose_name="Name of county") city_name = CharField(verbose_name="Name of city") physical_address = EmbeddedDocumentField( PhysicalAddress, verbose_name="Phyiscal address information") mailing_address = EmbeddedDocumentField( MailingAddress, verbose_name="Mailing address information") phone_number = CharField(verbose_name="Office phone number", required=True) email_address = EmailField(verbose_name="Office email address") office_supervisor = CharField(verbose_name="Name of office supervisor") supervisor_title = CharField(verbose_name="Job title of office supervisor") website = CharField(verbose_name="Website data was fetched from", required=True) class Meta: write_concern = WriteConcern(j=True) connection_alias = LOCAL_DB_ALIAS
class USER(MongoModel): name = CharField() key = CharField() role = IntegerField() mobile = CharField() email = CharField() remark = CharField() thumb = ObjectIdField() certification = ObjectIdField(blank=True) token = CharField() tenant = ObjectIdField(blank=True) delete = BooleanField() createdAt = DateTimeField() updatedAt = DateTimeField() lastLogin = DateTimeField() class Meta: collection_name = 'user' final = True
class SameMongoName(MongoModel): field = CharField() new_field = CharField(mongo_name='field')
class Document(MongoModel): name = CharField()
class Document(MongoModel): name = CharField() class Meta: ignore_unknown_fields = True
class MailingAddress(PhysicalAddress): street = CharField(verbose_name="Name of street")
class ModelWithBlankField(MongoModel): field = CharField(blank=True)
class Document(MongoModel): name = CharField() age = IntegerField()
class SameMongoNameAsParent(Parent): child_field = CharField()
class Article(MongoModel): title = CharField() class Meta: connection_alias = 'foo-connection'
class Article(MongoModel): title = CharField() class Meta: connection_alias = 'foo-connection' indexes = [IndexModel([('title', 1)])]
class Parent(MongoModel): field = CharField(mongo_name='child_field')