class Meta:
     app_label = "gbe"
     ordering = ['group__order', 'order']
     constraints = [UniqueConstraint(fields=['name', 'group'],
                                     name='label_unique_name'),
                    UniqueConstraint(fields=['order', 'group'],
                                     name='label_unique_order')]
예제 #2
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=['french_name'],
                          name='unique_mage_french_name'),
         UniqueConstraint(fields=['english_name'],
                          name='unique_mage_english_name')
     ]
예제 #3
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=['twitter_id'],
                          name="unique_tweet_constraint_id"),
         UniqueConstraint(fields=['text'],
                          name="unique_tweet_constraint_text"),
     ]
예제 #4
0
파일: models.py 프로젝트: macph/inventory
 class Meta:
     constraints = [
         UniqueConstraint(fields=["user", "name"],
                          name="unique_item_user_name"),
         UniqueConstraint(fields=["user", "ident"],
                          name="unique_item_user_ident"),
         CheckConstraint(check=Q(minimum__gte=0),
                         name="check_item_minimum_not_negative"),
     ]
예제 #5
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=['student_request'],
                          condition=Q(failed=False, successful=False),
                          name='unique_active_match_per_student'),
         UniqueConstraint(fields=['tutor_request'],
                          condition=Q(failed=False, successful=False),
                          name='unique_active_match_per_tutor')
     ]
예제 #6
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=['name'],
                          condition=Q(parent_id__isnull=True),
                          name='unique_unit_name'),
         UniqueConstraint(fields=['name', 'parent_id'],
                          condition=Q(parent_id__isnull=False),
                          name='unique_department_name')
     ]
예제 #7
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=["mid"],
                          name="unique_mid",
                          condition=~Q(mid="")),
         UniqueConstraint(fields=["name", "kind"],
                          name="unique_name_kind",
                          condition=Q(mid="")),
     ]
예제 #8
0
 class Meta:
     constraints = [
         UniqueConstraint(name="unique_text_id", fields=["website", "text_id"]),
         UniqueConstraint(
             name=CONTENT_FILEPATH_UNIQUE_CONSTRAINT,
             fields=("website", "dirpath", "filename"),
             condition=Q(is_page_content=True),
         ),
     ]
예제 #9
0
 class Meta:
     constraints = [
         UniqueConstraint(fields=['team', 'challenge'],
                          condition=Q(correct=True, team__isnull=False),
                          name='unique_team_challenge_correct'),
         UniqueConstraint(fields=['solved_by', 'challenge'],
                          condition=Q(correct=True),
                          name='unique_member_challenge_correct')
     ]
     indexes = [BrinIndex(fields=['challenge'], autosummarize=True)]
예제 #10
0
파일: models.py 프로젝트: vineetsgr07/zulip
 class Meta:
     # Handles invalid duplicate InstallationCount data
     constraints = [
         UniqueConstraint(fields=["property", "subgroup", "end_time"],
                          condition=Q(subgroup__isnull=False),
                          name='unique_installation_count'),
         UniqueConstraint(fields=["property", "end_time"],
                          condition=Q(subgroup__isnull=True),
                          name='unique_installation_count_null_subgroup')
     ]
 class Meta:
     ordering = ['milestone__name']
     constraints = [
         UniqueConstraint(
             fields=['milestone', 'feature', 'scenario', 'mapping', 'ids'],
             name='unique_%(class)s_composite_constraint_with_ids'),
         UniqueConstraint(
             fields=['milestone', 'feature', 'scenario', 'mapping'],
             condition=Q(ids=None),
             name='unique_%(class)s_composite_constraint_without_ids')
     ]
예제 #12
0
 class Meta:
     constraints = [
         UniqueConstraint(
             name="no two fines can have the same order per house",
             fields=["house", "order"],
         ),
         UniqueConstraint(
             name="only one fine period can be current per house",
             fields=["house", "is_current_fine_period"],
             condition=Q(is_current_fine_period=True),
         ),
     ]
예제 #13
0
 class Meta:
     constraints = [
         UniqueConstraint(
             fields=["name", "parent_id", "org_id"],
             name="folder_name_unique_for_org_level",
         ),
         UniqueConstraint(
             fields=["name", "org_id"],
             condition=Q(parent_id__isnull=True),
             name="folder_name_unique_for_org_level_at_root",
         ),
     ]
예제 #14
0
 class Meta:
     constraints = [
         UniqueConstraint(
             fields=['name', 'env', 'platform', 'os', 'deleted'],
             name='unique_%(class)s_composite_constraint'
         ),
         # without deletion date
         UniqueConstraint(
             fields=['name', 'env', 'platform', 'os'], condition=Q(deleted=None),
             name='unique_%(class)s_composite_constraint_w_empty_deleted'
         )
     ]
예제 #15
0
 class Meta:
     constraints = [
         UniqueConstraint(
             fields=['name'],
             name='unique_os_name'
         ),
         UniqueConstraint(
             fields=['shortcut'],
             name='unique_os_shortcut'
         )
     ]
     verbose_name_plural = 'Oses'
예제 #16
0
 class Meta:
     constraints = [
         UniqueConstraint(
             fields=['name', 'build_id'],
             name='unique_%(class)s_composite_constraint'
         ),
         # one null
         UniqueConstraint(
             fields=['name'], condition=Q(build_id=None),
             name='unique_%(class)s_composite_constraint_with_build_id_null'
         )
     ]
예제 #17
0
 class Meta:
     constraints = [
         UniqueConstraint(
             name="no two dishwashers can have the same order per house",
             fields=["house", "order"],
         ),
         UniqueConstraint(
             name="only one dishwasher can be current per house",
             fields=["house", "is_current_dishwasher"],
             condition=Q(is_current_dishwasher=True),
         ),
     ]
예제 #18
0
파일: models.py 프로젝트: vineetsgr07/zulip
 class Meta:
     # Handles invalid duplicate RealmCount data
     constraints = [
         UniqueConstraint(
             fields=["realm", "property", "subgroup", "end_time"],
             condition=Q(subgroup__isnull=False),
             name='unique_realm_count'),
         UniqueConstraint(fields=["realm", "property", "end_time"],
                          condition=Q(subgroup__isnull=True),
                          name='unique_realm_count_null_subgroup')
     ]
     index_together = ["property", "end_time"]
예제 #19
0
 class Meta:
     app_label = "rescape_region"
     constraints = [
         # https://stackoverflow.com/questions/33307892/django-unique-together-with-nullable-foreignkey
         # This says that for deleted locations, user and key and deleted date must be unique
         UniqueConstraint(fields=['user', 'deleted', 'key'],
                          name='unique_project_with_deleted'),
         # This says that for non-deleted locations, user and key must be unique
         UniqueConstraint(fields=['user', 'key'],
                          condition=Q(deleted=None),
                          name='unique_project_without_deleted'),
     ]
예제 #20
0
 class Meta:
     # 4 UniqueConstraints for unique_together for 'relationship','organization',
     # 'record_id', 'record_uuid', 'related_record_id', 'related_record_uuid'
     constraints = [
         UniqueConstraint(
             fields=(
                 'relationship',
                 'record_id',
                 'related_record_id',
             ),
             name='unique_join_record_ids',
             condition=Q(record_uuid=None, related_record_uuid=None)
         ),
         UniqueConstraint(
             fields=(
                 'relationship',
                 'record_uuid',
                 'related_record_uuid',
             ),
             name='unique_join_record_uuids',
             condition=Q(record_id=None, related_record_id=None)
         ),
         UniqueConstraint(
             fields=(
                 'relationship',
                 'record_id',
                 'related_record_uuid',
             ),
             name='unique_join_record_id_uuid',
             condition=Q(record_uuid=None, related_record_id=None)
         ),
         UniqueConstraint(
             fields=(
                 'relationship',
                 'record_uuid',
                 'related_record_id',
             ),
             name='unique_join_record_uuid_id',
             condition=Q(record_id=None, related_record_uuid=None)
         ),
         CheckConstraint(
             name='one_record_primary_key',
             check=~Q(record_id=None, record_uuid=None) & (~(~Q(record_id=None) & ~Q(record_uuid=None)))
         ),
         CheckConstraint(
             name='one_related_record_primary_key',
             check=~Q(related_record_id=None, related_record_uuid=None) & (
                 ~(~Q(related_record_id=None) & ~Q(related_record_uuid=None)))
         ),
     ]
예제 #21
0
 class Meta:
     constraints = [
         UniqueConstraint(
             fields=["team", "challenge"],
             condition=Q(correct=True, team__isnull=False),
             name="unique_team_challenge_correct",
         ),
         UniqueConstraint(
             fields=["solved_by", "challenge"],
             condition=Q(correct=True),
             name="unique_member_challenge_correct",
         ),
     ]
     indexes = [BrinIndex(fields=["challenge"], autosummarize=True)]
예제 #22
0
파일: models.py 프로젝트: vineetsgr07/zulip
 class Meta:
     # Handles invalid duplicate UserCount data
     constraints = [
         UniqueConstraint(
             fields=["user", "property", "subgroup", "end_time"],
             condition=Q(subgroup__isnull=False),
             name='unique_user_count'),
         UniqueConstraint(fields=["user", "property", "end_time"],
                          condition=Q(subgroup__isnull=True),
                          name='unique_user_count_null_subgroup')
     ]
     # This index dramatically improves the performance of
     # aggregating from users to realms
     index_together = ["property", "realm", "end_time"]
예제 #23
0
파일: models.py 프로젝트: jwnasambu/oclapi2
 class Meta:
     db_table = 'sources'
     constraints = [
         UniqueConstraint(
             fields=['mnemonic', 'version', 'organization'],
             name="org_source_unique",
             condition=models.Q(user=None),
         ),
         UniqueConstraint(
             fields=['mnemonic', 'version', 'user'],
             name="user_source_unique",
             condition=models.Q(organization=None),
         )
     ]
예제 #24
0
 class Meta:
     unique_together = (
         ('label', 'crud_view'),
         ('layer', 'crud_view'),
     )
     constraints = [
         UniqueConstraint(fields=['provider', 'layer', 'crud_view'],
                          condition=Q(layer__isnull=False),
                          name='check_provider_layer'),
         UniqueConstraint(
             fields=['provider', 'mapbox_transit', 'crud_view'],
             condition=~Q(mapbox_transit=''),
             name='check_provider_mapbox_transit'),
     ]
예제 #25
0
 class Meta(OrderedModel.Meta):
     db_table = 'pins'
     ordering = ['order']
     constraints = [
         UniqueConstraint(
             fields=['resource_type', 'resource_id', 'user'],
             name="user_pin_unique",
             condition=models.Q(organization=None),
         ),
         UniqueConstraint(
             fields=['resource_type', 'resource_id', 'organization'],
             name="org_pin_unique",
             condition=~models.Q(organization=None),
         )
     ]
예제 #26
0
 class Meta(BaseProvidedFileAsset.Meta, BenefitFeatureConfiguration.Meta):
     verbose_name = "Provided File Configuration"
     verbose_name_plural = "Provided File Configurations"
     constraints = [
         UniqueConstraint(fields=["internal_name"],
                          name="uniq_provided_file_asset_cfg")
     ]
예제 #27
0
 class Meta(BaseRequiredTextAsset.Meta, BenefitFeatureConfiguration.Meta):
     verbose_name = "Require Text Configuration"
     verbose_name_plural = "Require Text Configurations"
     constraints = [
         UniqueConstraint(fields=["internal_name"],
                          name="uniq_text_asset_cfg")
     ]
예제 #28
0
 class Meta:
     constraints = [
         UniqueConstraint(  # Make sure every document has at most one tree
             name='single_root_per_document',
             fields=["document", "depth"],
             condition=Q(depth=1))
     ]
예제 #29
0
 class Meta:
     app_label = APP_LABEL
     abstract = False
     constraints = [
         UniqueConstraint(fields=['order', 'sku', 'email'],
                          name='unique_order_sku_email')
     ]
예제 #30
0
파일: models.py 프로젝트: ps-iria/api_yamdb
 class Meta:
     constraints = [
         UniqueConstraint(fields=['title', 'author'], name='unique_review')
     ]
     ordering = ['-pub_date']
     verbose_name = 'Отзыв'
     verbose_name_plural = 'Отзывы'