Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8834375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:59:51+00:00 2026-06-14T08:59:51+00:00

I want to create a minimalist task management app to learn Django’s basics. So

  • 0

I want to create a minimalist task management app to learn Django’s basics. So there will be Projects , Tasks and Users as the three big entities.

  • A Project can have multiple users
  • A Project can have multiple tasks
  • A task can be assigned to 1 user

I can unable to figure out how to do a Many-to-One from Project – > Users using django.contrib.auth.models.User as my Users source.

This is what I have so far, but I know it is wrong and I am unable to wrap my head around it. I tried to relate to other questions such as the one with Contestents and the one with Vulnerabilities URLS on StackOverflow. I am not sure if I have to write my own User Model, or somehow extend it.

class Project(models.Model):
    Project_Name = models.CharField(max_length=100)
    Project_Users = models.ManyToManyField(User)

class Tasks(models.Model):
    Task_Name = models.CharField(max_length=300)
    Task_AssignedToUser = models.ForeignKey("Project_Name", through=Users)

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:59:52+00:00Added an answer on June 14, 2026 at 8:59 am
    class Project(models.Model):
        name = models.CharField(max_length=100)
        users = models.ManyToManyField(User)
    
    class Task(models.Model):
        project = models.ForeignKey(Project, related_name='project_tasks')
        name = models.CharField(max_length=300)
        assignee = models.ForeignKey(User, related_name='tasks')
    

    Get the the users participating in a specific project:

    p = Project.objects.get(name='myproject')
    users = p.users.all()
    

    Get a project’s tasks:

    users = p.project_tasks.all()  # Because of `related_name` in Task.project
    

    Get All the tasks a user has, of all the projects:

    u = User.objects.get(username='someuser')
    u.tasks.all()  # Because of `related_name` in Task.assignee
    

    Notes:

    1. A ForeignKey is a Many to One relationship. e.g. A Task belongs to only one Project – A Project can have many Tasks.

    2. You don’t need superfluous field names. name is better than Project_Name

    3. One question at a time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want create an app for my institute. The problem is: my application will
I want create wordpress website into which I want create user management... That means
I want to create a Silverlight app to extract and manipulate data from an
I want create listview without layout_height. I mean if there is 100 item in
I want create a tarball that when extracted the file(s) will be placed at
I want create Mysql data base in asp.net (c#) as Dynamically.My task is when
I want create constructor that will take one or more integers and save it
I want create a role in SQL server 2008, which will allows specific group
I want create a script, running in a cron to perform a task that
I want create some simple animation for my program. There is 4 invisible button,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.