Skip to content

Commit

Permalink
Revert the mixins in the models
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Jan 22, 2025
1 parent 5a5a927 commit 78fef9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions docker-app/qfieldcloud/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
from qfieldcloud.core.utils2 import storage
from qfieldcloud.subscription.exceptions import ReachedMaxOrganizationMembersError
from timezone_field import TimeZoneField
from qfieldcloud.core.fields import (
DynamicStorageFileField,
FileStorageNameModelProtocol,
)
from qfieldcloud.core.fields import DynamicStorageFileField


if TYPE_CHECKING:
Expand Down Expand Up @@ -1031,7 +1028,7 @@ def get_project_thumbnail_upload_to(instance: "Project", _filename: str) -> str:
return f"projects/{instance.id}/meta/thumbnail.png"


class Project(models.Model, FileStorageNameModelProtocol):
class Project(models.Model):
"""Represent a QFieldcloud project.
It corresponds to a directory on the file system.
Expand Down
7 changes: 2 additions & 5 deletions docker-app/qfieldcloud/filestorage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

from qfieldcloud.core.models import Job, Project, User
from qfieldcloud.core.utils2 import storage
from qfieldcloud.core.fields import (
DynamicStorageFileField,
FileStorageNameModelProtocol,
)
from qfieldcloud.core.fields import DynamicStorageFileField
from qfieldcloud.core.validators import MaxBytesLengthValidator
from .utils import calc_etag, filename_validator

Expand Down Expand Up @@ -242,7 +239,7 @@ def get_file_version_upload_to(instance: "FileVersion", _filename: str) -> str:
raise NotImplementedError()


class FileVersion(models.Model, FileStorageNameModelProtocol):
class FileVersion(models.Model):
def _get_file_storage_name(self) -> str:
"""Returns the file storage name where all the files are stored. Used by `DynamicStorageFileField` and `DynamicStorageFieldFile`."""
return self.file.project.file_storage
Expand Down

0 comments on commit 78fef9a

Please sign in to comment.