equal
deleted
inserted
replaced
788 content = file(attach.data.path).read() |
788 content = file(attach.data.path).read() |
789 mimetype, _encoding = mimetypes.guess_type(attach.data.path) |
789 mimetype, _encoding = mimetypes.guess_type(attach.data.path) |
790 response = HttpResponse(content, mimetype) |
790 response = HttpResponse(content, mimetype) |
791 return response |
791 return response |
792 |
792 |
793 |
793 def notext_attach(request, attach_key): |
794 |
794 attach = Attachment.objects.get(key=attach_key) |
795 |
795 content = file(attach.data.path).read() |
|
796 mimetype, _encoding = mimetypes.guess_type(attach.data.path) |
|
797 response = HttpResponse(content, mimetype) |
|
798 return response |
|
799 |
796 def fix_anon_in_formset(formset): |
800 def fix_anon_in_formset(formset): |
797 # fix role choice in formset for anon (not all role are allowed) |
801 # fix role choice in formset for anon (not all role are allowed) |
798 role_field = [f.fields['role'] for f in formset.forms if f.instance.user == None][0] |
802 role_field = [f.fields['role'] for f in formset.forms if f.instance.user == None][0] |
799 role_field.choices = [(u'', u'---------')] + [(r.id, str(r)) for r in Role.objects.filter(anon = True)] # limit anon choices |
803 role_field.choices = [(u'', u'---------')] + [(r.id, str(r)) for r in Role.objects.filter(anon = True)] # limit anon choices |
800 |
804 |