Skip to content

Commit

Permalink
Fix DJ012 Order of model does not follow the Django Style Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Nov 16, 2023
1 parent d972e13 commit 97ee8c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions dandiapi/analytics/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@


class ProcessedS3Log(models.Model):
class Meta:
constraints = [
models.UniqueConstraint(
fields=['name', 'embargoed'],
name='%(app_label)s_%(class)s_unique_name_embargoed',
)
]

name = models.CharField(
max_length=36,
validators=[
Expand All @@ -20,3 +12,11 @@ class Meta:
)
# This is necessary to determine which bucket the logfile corresponds to
embargoed = models.BooleanField()

class Meta:
constraints = [
models.UniqueConstraint(
fields=['name', 'embargoed'],
name='%(app_label)s_%(class)s_unique_name_embargoed',
)
]
8 changes: 4 additions & 4 deletions dandiapi/api/models/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
class BaseUpload(models.Model):
ETAG_REGEX = r'[0-9a-f]{32}(-[1-9][0-9]*)?'

class Meta:
indexes = [models.Index(fields=['etag'])]
abstract = True

created = CreationDateTimeField()

# This is the key used to generate the object key, and the primary identifier for the upload.
Expand All @@ -41,6 +37,10 @@ class Meta:
multipart_upload_id = models.CharField(max_length=128, unique=True, db_index=True)
size = models.PositiveBigIntegerField()

class Meta:
indexes = [models.Index(fields=['etag'])]
abstract = True

@staticmethod
@abstractmethod
def object_key(upload_id, *, dandiset: Dandiset): # noqa: N805
Expand Down
4 changes: 2 additions & 2 deletions dandiapi/search/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ def visible_to(self, user: User) -> models.QuerySet[AssetSearch]:


class AssetSearch(models.Model):
objects = AssetSearchManager()

dandiset_id = models.PositiveBigIntegerField()
asset_id = models.PositiveBigIntegerField(primary_key=True)
asset_metadata = models.JSONField()
asset_size = models.PositiveBigIntegerField()

objects = AssetSearchManager()

class Meta:
managed = False
db_table = 'asset_search'
Expand Down

0 comments on commit 97ee8c7

Please sign in to comment.