Skip to content

Commit dffc7d1

Browse files
committed
wip files
1 parent a3f75a0 commit dffc7d1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

baseapp-files/baseapp_files/graphql/object_types.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class Meta:
2727
filterset_class = FileFilter
2828

2929
def resolve_file(self, info, **kwargs):
30-
return self.file.url
30+
# return self.file.url
31+
return info.context.build_absolute_uri(self.file.url)
3132

3233
# @classmethod
3334
# def get_node(cls, info, id):

baseapp-files/baseapp_files/models.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ class File(TimeStampedModel):
2929
parent_content_type = models.ForeignKey(
3030
ContentType,
3131
null=True,
32+
blank=True,
3233
on_delete=models.CASCADE,
3334
)
34-
parent_object_id = models.PositiveIntegerField(null=True)
35+
parent_object_id = models.PositiveIntegerField(null=True, blank=True)
3536
parent = GenericForeignKey("parent_content_type", "parent_object_id")
3637

3738
content_type = models.CharField(max_length=150, null=True, blank=True)
@@ -50,7 +51,7 @@ class File(TimeStampedModel):
5051
created_by = models.ForeignKey(
5152
settings.AUTH_USER_MODEL,
5253
related_name="files_created",
53-
on_delete=models.DO_NOTHING,
54+
on_delete=models.CASCADE,
5455
null=True,
5556
)
5657

0 commit comments

Comments
 (0)