User Models in SailPilot
The User models in SailPilot’s backend encompass functionalities related to user data management and interactions with other components of the application. They are pivotal in managing authentication, user profiles, and user-related transactions.
Profile Model
The Profile model extends the default Django User model, adding additional fields such as date of birth, contact information, and address. It is linked to the User model via a one-to-one relationship, ensuring each user has one associated profile.
Fields: Includes date of birth, phone, fax, address, city, area, zip code, and country.
Signals: Utilizes Django’s signals to automatically create and update the Profile instance when a User instance is created or saved.
UserPurchases Model
The UserPurchases model tracks the purchases made by users within the application. It is crucial for managing the commercial aspect of the application, recording transaction details, and linking to the FeatureLibraries model.
Fields: Includes user (linked to Django User), purchase date, country, area, and language.
Relation: Has a foreign key relationship with the User model and the FeatureLibraries model.
Database Table: The model uses a custom database table user_purchases.