1

It doesn't seem as if django-postman supports attachments so I'm trying to add attachment support. I'm thinking of doing it by creating another set of models that will refer to a postman message and then update the views/templates accordingly but it will be a fair amount of work.

Dan Goldin
  • 957
  • 13
  • 32

2 Answers2

0

Django-postman isn't exactly an SMTP based messaging system so attachments would need to implemented through a different module. I think you should check some of the django file management projects

https://www.djangopackages.com/grids/g/file-managers/

One of the simplest idea I can think of is to save files in some kind of hashed name and associate these names with the postman message .

I think this would be a good addition to postman itself.

dusual
  • 2,097
  • 3
  • 19
  • 26
  • Yea - my current approach is to have a separate "attachment" model that consists of a FileField and a few others and another model that links these attachments to the message. I'm not a big expert on Django packages so it feels like I'm rewriting a bunch of the postman views (reply, view) and templates which makes me feel I'm not going about it the right way. – Dan Goldin May 15 '13 at 17:40
  • I think the best way to approach this would be look at how the django comments framework works . It requires very little changes to the original contenttype its associated with , You should also check signals etc ... This way you can implement this without much many changes to postman – dusual May 15 '13 at 17:50
  • 1
    So I spent today on adding this functionality and was able to get it to work. Unfortunately, I don't think the app itself is easily transferrable but the approach can be. I'll try to write it up in a blog post in the next few days while it's still fresh in my mind. – Dan Goldin May 17 '13 at 02:35
0

So I ended up figuring out how to do this on my own but it could use some work. The additional constraint we had to work with was that we were already using jQuery File Upload to upload files via AJAX so we needed a way to integrate the two.

Our solution was to create an app that contained a new model and a custom reply form that made it relatively easy to link the two together.

I wrote it up at http://dangoldin.com/2013/05/17/adding-attachments-to-django-postman/ and hope it helps others.

Dan Goldin
  • 957
  • 13
  • 32