I am trying to implement the Finanace application with many classes (wrt java).
I have this case
class User {
String name;
Int age;
Collection<Accounts> accounts;
Interface Account
Then following classes implements interface
- Saving Account
- Fixed Account
- Insurance Account
The account will have User Object
As i am java person , i want to know can i use collection of Account objects in my user class.
Also how will Django handle the relationships and make database tables if i use collection
You probably want to use
django.contrib.auth, which already provides aUsermodel, so you’ll want to write a model to store additional user information, instead of defining a newUsermodel. Django models (generally) represent database tables, each attribute represents a database field. You define your models and their relationships, and Django provides a nice database-access API. You generally don’t “store collection of Account objects”, you create another model and use aForeignKeyfield to describe the relationship between the models.And then you’d use Django’s API to work with your models:
Django’s tutorial is a good place to start, if you want to use Django for this project you need some concept of how things are done. It’s also might be a good idea to learn python first.