Currently I am working on project in which I need to calculate all the payment methods of complete event by using django model's field, I have to calculate the data and convert it into file which I need to upload into another table. My project is configured by Amazon S3. I need to show the file path in API, so my file will be stored in my model and when I hit API my updated report's path come as Response
I see many solutions, but still can't fulfill my requirement.
for example:
My Model:
class foo(models.Model):
....
....
another model in which I want to save:
class Report(models.Model):
report =models.FileField(..)
My API:
class fooAPIView(ListCreateApiView):
foo_queryset = foo.objects.all()
report = Report.objects.create(report= foo_queryset)
return Response(report.url)
Whats the best practice and way to create the file and saved in django models