code cleanup: Remove unused Attachment methods.

This removes some unused code on Attachment.  Some of these
methods might be useful in a manage.py shell, but without tests,
they are not very trustworthy, and the Attachment model isn't that
complicated to write raw Django queries against.
This commit is contained in:
Steve Howell 2016-10-03 15:46:58 -07:00 committed by Tim Abbott
parent 732bf5e6d0
commit 5ae8cff289
1 changed files with 0 additions and 16 deletions

View File

@ -1279,22 +1279,6 @@ class Attachment(ModelReprMixin, models.Model):
# type: () -> bool # type: () -> bool
return self.messages.count() > 0 return self.messages.count() > 0
def get_url(self):
# type: () -> text_type
return u"/user_uploads/%s" % (self.path_id)
def get_attachments_by_owner_id(uid):
# type: (int) -> Sequence[Attachment]
# TODO: Change return type to QuerySet[Attachment]
return Attachment.objects.filter(owner=uid).select_related('owner')
def get_owners_from_file_name(file_name):
# type: (str) -> Sequence[Attachment]
# TODO: Change return type to QuerySet[Attachment]
# The returned vaule will list of owners since different users can upload
# same files with the same filename.
return Attachment.objects.filter(file_name=file_name).select_related('owner')
def get_old_unclaimed_attachments(weeks_ago): def get_old_unclaimed_attachments(weeks_ago):
# type: (int) -> Sequence[Attachment] # type: (int) -> Sequence[Attachment]
# TODO: Change return type to QuerySet[Attachment] # TODO: Change return type to QuerySet[Attachment]