Broad hint needed: Where to put "supporting" classes?

Hi all,

I’m new to django and read through the great tutorial and some other parts of the documentation. My question might be redudant and I’m pretty sure that lots of documentation exists on that topic, but obviously I’m using the wrong buzzwords because I didn’t find anything in the documentation, in this forum and on google. :frowning:

In the file I created a View showing a form for uploading a CSV-file. Reading the data from the file works quite good. Now I would like to write a re-usable class for manipulating the data which I can use in other views of the same app too.

The really simple question:
Following good programming practice, where / in which folder and file do I create a class that shall be utilized by several views? (I know that I can probably create such a class at many places, but is there a “right” place?)

It would be very appreciated if you could give me a broad hint on that. A link to the documentation or just a buzzword would be totally fine for me. :slight_smile:

You’re not going to find anything in the docs because there’s no fixed requirement. Some people will have a file named If you browse through this forum, you’ll likely find references to other names.

You could look at some open source project’s source code to see how other people do it to get some ideas. (You could look at projects like Django-rest-framework, wagtail, Django-debug-toolbar, etc.)

My opinion would be that as long as the name isn’t misleading, there is no wrong answer.

1 Like

IMO, there are few good approaches:

  1. Create a common Django application (say core) inside your project
  2. Create a redistribute library (package) with views and other modules
  3. A combination of 1 and 2