Reputation: 4295
I do not have code to discuss this. But more of a conceptual issue.
Say the user would upload some file through a web file page or input some parameters via a page.
Models.py would be storing all the data which I would need to have stored in my database.
My question would be say after the user submits the webpage data via a form. Where should I put my processing logic? In forms.py? If it's a complex process what should be a proper design pattern to put this code?
Upvotes: 0
Views: 288
Reputation: 9709
Upvotes: 1
Reputation: 1646
In Django's typical pattern, you'd handle the request in your app's views.py file. It is simply by convention, you are free to place your code anywhere, but if you are learning and following along with tutorials, views.py is normally where this logic would be expected.
https://docs.djangoproject.com/en/1.10/topics/http/views/
If your model uses FileField, the uploaded files are not stored in the database, rather uploaded files are stored in path specified in your project settings MEDIA_ROOT value. The database FileField stores a relative reference to the file path from MEDIA_ROOT.
https://docs.djangoproject.com/en/1.10/topics/http/file-uploads/
Upvotes: 1