Skip to content

Commit

Permalink
To support use in projects w Django Admin user deletion, where a rela…
Browse files Browse the repository at this point in the history
…tionship to the example ChunkedUpload model is not desired, ChunkedUpload is now unmanaged and does not have a user field.
  • Loading branch information
Trevor Cox committed Aug 23, 2021
1 parent 2d49a8c commit bab16d3
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions chunked_upload/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,16 @@ class ChunkedUpload(AbstractChunkedUpload):
"""
Default chunked upload model.
"""
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
related_name='chunked_uploads',
null=DEFAULT_MODEL_USER_FIELD_NULL,
blank=DEFAULT_MODEL_USER_FIELD_BLANK
)
class Meta:
managed=False
app_label = 'chunked_upload'
# Even if this model is not used or the table is not created,
# the Django Admin delete user code will look for these related objects
# if this code is included:
# user = models.ForeignKey(
# settings.AUTH_USER_MODEL,
# on_delete=models.CASCADE,
# related_name='chunked_uploads',
# null=DEFAULT_MODEL_USER_FIELD_NULL,
# blank=DEFAULT_MODEL_USER_FIELD_BLANK
# )

0 comments on commit bab16d3

Please sign in to comment.