Skip to content

Instantly share code, notes, and snippets.

@Nipun2016
Last active February 9, 2018 06:00
Show Gist options
  • Save Nipun2016/0d392ea66c428e85de3db71fceb16719 to your computer and use it in GitHub Desktop.
Save Nipun2016/0d392ea66c428e85de3db71fceb16719 to your computer and use it in GitHub Desktop.
from wgadmin.models import *
def get_file_attachment_url(object):
from django.contrib.contenttypes.models import ContentType
contenttype_obj = ContentType.objects.get_for_model(object)
return FileAttachment.objects.values('attachment_file','object_id').filter(object_id=object.id,
content_type=contenttype_obj)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment