Project-Stage-Academy / UA1198ForumSB

UA-1198 Project Stage Forum SandBox
0 stars 0 forks source link

Define Django Models for Users, Startups, and Investors #26

Closed mehalyna closed 1 week ago

mehalyna commented 2 weeks ago

Define Django Models for Users, Startups, and Investors

Create Django models for the User, Startup, and Investor entities that reflect the provided database schema. Ensure all fields and relationships are accurately represented within the Django ORM.

Task Description:

  1. Define the User Model

    • Action: In your users app (create one if it doesn't exist), define a User model in models.py with all the fields as specified in the schema: user_id, first_name, last_name, email, password, user_phone, title, and role.
    • Fields:
      • Use models.AutoField for user_id with primary_key=True.
      • Use models.CharField for string-based fields.
      • Add email uniqueness constraint using unique=True.
      • Consider using models.IntegerField or models.PositiveSmallIntegerField for the role field.
  2. Define the Startup Model

    • Action: In your startups app, define a Startup model with fields as per the schema and a foreign key relationship to the User model (user_id).
    • Fields:
      • Use models.ForeignKey to link user_id to the User model with on_delete=models.CASCADE.
      • For the startup_logo field, consider using models.ImageField or models.BinaryField depending on how you wish to handle image data.
      • Use appropriate field types for other fields, such as models.CharField and models.TextField.
  3. Define the Investor Model

    • Action: In your investors app, create an Investor model that includes the necessary fields and a foreign key to User.
    • Fields:
      • As with the Startup model, ensure there is a models.ForeignKey linking to the User model.
      • Decide whether to use models.ImageField or models.BinaryField for investor_logo.
      • Use suitable field types for other attributes, mirroring the structure used in the Startup model.
  4. Define the Project Model

    • Action: Assuming a projects app exists, define a Project model including a foreign key to both Startup and Investor.
    • Fields:
      • Define two models.ForeignKey relationships, one to Startup and one to Investor.
      • Include fields for description, business_plan (could be a models.FileField if storing documents), media_files, status, created_at, last_update, and duration.

Considerations:

Deliverables: