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 7035559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:19:06+00:00 2026-05-28T01:19:06+00:00

I need a model that will be linked to a maximum of 3 data

  • 0

I need a model that will be linked to a maximum of 3 data (of the same type).

Here is an example:
I have candidates that need to pass 3 steps to be recruited

class Candidate(models.Model):
  user = models.ForeignKey(User)
  step1 = models.TextField(blank=True, null=True,)
  step2 = models.TextField(blank=True, null=True,)
  step3 = models.TextField(blank=True, null=True,)

For each step there is a review by several persons

class Review(models.Model):
  candidate = models.ForeignKey(Candidate)
  reviewer = models.ForeignKey(User)
  step1 = models.TextField(blank=True, null=True,)
  step2 = models.TextField(blank=True, null=True,)
  step3 = models.TextField(blank=True, null=True,)
  • Should I factorize these objects which would give me 4 objects instead of 2
    such as Candidate, Review, CandidateStep and ReviewStep ?

    • If yes, how can I limit to 3 steps ?
    • If not, how can easily iterate through the steps ?

Example data:

obj, created = Candidate.objects.get_or_create(
  user = SelectedCandidate
, defaults = {'step1': '', 'step2': '', 'step3': ''}
)
obj.step1 = 'I\'m really motivated'
obj.step2 = 'I\'m able to do this job'
obj.save()

obj, created = Review.objects.get_or_create(
  user = request.user
, defaults = {'step1': '', 'step2': '', 'step3': ''}
)
obj.step1 = 'He seems over motivated'
obj.save()
  • 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-05-28T01:19:07+00:00Added an answer on May 28, 2026 at 1:19 am

    What about three objects:

    class Candidate(models.Model):
        name = models.CharField(max_length=50)
    
    class Step(model.Model):
        candidate = models.ForeignKey(Candidate)
        text = models.TextField(blank=True)
    
    class Review(models.Model):
        reviewer = models.ForeignKey(User)
        step =  models.OneToOneField(Step)
        text = models.TextField(blank=True)
    

    how can I limit to 3 steps ?

    On view level. If you are going to use ModelFromset, using max_num option.

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

Sidebar

Related Questions

i have very simple problem. I need to create model, that represent element of
I have a model that already has a couple dozen of columns that will
Here is my example : We have printers. We can define page formats that
I'm trying to create a generic data model that will allow for a particular
My problem is a python/django mix. I have a form model that will display
I have a few models that need to have custom find conditions placed on
I like to have a popup modal dialog that need to show the list
I have a need for a model(?) on my app which basically contains a
I need to store some data in a Django model. These data are not
I have a prototype model where I need to include the following extension methods

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.