Add an attachment?
Closed this issue · 10 comments
First of all, thanks for this nice project. I was looking for pretty much exactly this, and stumbled upon a few other solutions that either didn't work, or were too complex or I struggled with the install. This one was very well documented and works like a charm.
My basic idea is to keep track of all the expenses we spend in our household. Mostly I want to check the expenses of my helper, so I will ask her to record her expenses. It would be very helpful if it was possible to upload a photo/PDF with the expense. It would allow to have more information on the actual expense, i.e. I could also attach the invoice for the utilities, copies of the supermarket receipts, pet food, etc. In a few months time, it is probably difficult to remember why a specific expense was so high, but with a quick check on the receipt it would clear up everything.
First of all, thanks for this nice project. I was looking for pretty much exactly this, and stumbled upon a few other solutions that either didn't work, or were too complex or I struggled with the install. This one was very well documented and works like a charm.
Thank you, I appreciate that! And I'm glad you've found it useful.
My basic idea is to keep track of all the expenses we spend in our household. Mostly I want to check the expenses of my helper, so I will ask her to record her expenses. It would be very helpful if it was possible to upload a photo/PDF with the expense. It would allow to have more information on the actual expense, i.e. I could also attach the invoice for the utilities, copies of the supermarket receipts, pet food, etc. In a few months time, it is probably difficult to remember why a specific expense was so high, but with a quick check on the receipt it would clear up everything.
Interesting idea, from both a technical perspective and pragmatic perspective --- because I have never worked with uploading files in Django before. I will see what I can implement when I find the time.
Wow, awesome. I'm looking forward to seeing a potential solution.
I finally had the time to work on it. See #17.
I added a field to upload a single image. Supporting other file types and/or multiple files would require more work, and be against the design philosophy of IHateToBuget, i.e. keeping things simple.
If you want to test this before I merge, you can switch locally to the upload-expense-image
branch.
I will check that out tomorrow and test the functionality. Looking forward to that.
I just pulled the branch, did the migration, updated the docker-compose (on the second attempt) and uploaded an image on two expenses. At first it failed, but that was cos of a problem with the reverse proxy.
I hate to Budget shows it has an image, I can see it in the docker volume, but it is not displayed on the webpage. I just get a broken image square. Also when editing the expense, and then click on the link of the image, I get a 404 page.
Now the image has a source of /media/expenses/Jasmine_0MhcCss.jpg
, while the image in the docker volume has a different file name. Although I also tried with the actual file name, but that didn't work as well (/media/expenses/16339299398574798733677715063621.jpg
).
So there seems to be something missing somewhere.
I also noticed, that even though I replaced the attached file, or cleared it, the file in the docker volume didn't get deleted. Not a potential problem, but it might be good, if the file would be actually removed from the disk.
And I tried it on my mobile, both selecting an image from the gallery as well as taking a photo worked to upload the photo.
Thank you for the feedback.
I just pulled the branch, did the migration, updated the docker-compose (on the second attempt) and uploaded an image on two expenses. At first it failed, but that was cos of a problem with the reverse proxy.
I hate to Budget shows it has an image, I can see it in the docker volume, but it is not displayed on the webpage. I just get a broken image square. Also when editing the expense, and then click on the link of the image, I get a 404 page.
Now the image has a source of /media/expenses/Jasmine_0MhcCss.jpg, while the image in the docker volume has a different file name. Although I also tried with the actual file name, but that didn't work as well (/media/expenses/16339299398574798733677715063621.jpg).
So there seems to be something missing somewhere.
I'll investigate. I also need to update the documentation.
I also noticed, that even though I replaced the attached file, or cleared it, the file in the docker volume didn't get deleted. Not a potential problem, but it might be good, if the file would be actually removed from the disk.
I am aware of this issue. Django does not seem to handle this by default, which is weird. I'll try to find a fix.
And I tried it on my mobile, both selecting an image from the gallery as well as taking a photo worked to upload the photo.
Cool.
Did you have a chance yet to look at the issue, that the attachment is not visible after an upload?
Sorry, I haven't found the time and motivation to work on this issue. To be honest, I have no idea what's wrong and why the file seems to have a different name. I am not able to replicate your issue.
Can you try it from a fresh instance? Maybe the problem lies in the migration process ; but I am not convinced by this explanation.
If the same issue continues to happen, maybe try to manually rename the file in the docker volume.
Sorry for not being able to provide further guidance.
PS: I updated the documentation, so make sure to use the correct version.
I tried a new instance, and somehow it wouldn't let me create any categories.
So I thought why not try the upgrade of my existing instance once again, and just pulled the new branch, did the migration, build, etc. and tried again. And now, ta-da, I do see the images, and also the ones that I uploaded previously.
That's really awesome!! Very nice, thanks again.