title: Is there a way to pass certain info, that is specific to a user, to the fields of a (new) django form?
body: <p>I have the following &quot;problem&quot;:
  I have automated a &quot;prediction-game&quot; where users can win points when they predict the correct winners in a sports event over multiple weeks (for example: Tour de France).
  They are allowed to choose 5 athletes of which they think that will win in the races.
  At the end of every week, the users are allowed to make some changes in their prediction for the next week.</p>
  <p>Until a certain date (start of the event or week), the users can choose athletes for their prediction. The users can fill in the form and if they change their minds before the start, they are still able to change/update their prediction. But after the start, they can't change it anymore and their input will be used to calculate their score. After the first week (in which their scores are calculate with the input they made in the &quot;PredictionWeek1&quot; model), they will have a change to make a new prediction for the next week (&quot;PredictionWeek2&quot; model) for which they also have the change to update it as much as they want before a certain date.</p>
  <p>In reality, the input for the second week, will be very similar to the first week: the users probably only want to change one or two athletes. Therefore, and this is the question, it will be best that the input form of &quot;PredictionWeek2&quot; is already filled in with their predictions for week 1, so that they don't have to select every athlete again.</p>
  <p>I have already tried to look for a way that their input from &quot;PredictionWeek1&quot; gets passed to the &quot;default&quot; argument for the 'charfield' in the models, but without any luck: I do not get it to be user specific...
  I also tried to do something similar as the &quot;UpdateView&quot;, but this was also not a solution the input for PredictionWeek2 can't be an &quot;update&quot; for PredictionWeek1: the point calculations in the first week need to be done with the input of PredictionWeek1 and the point calculations for the second week need to be done with the input of PredictionWeek2, so this need to be always a seperate input)</p>
  <p>The used code below (a little bit simplified for better comprehension):</p>
  <p>In views.py:</p>
  <p>class PredictionWeek1CreateView(LoginRequiredMixin, CreateView):</p>
  <pre><code>model = PredictionWeek1
  
  fields = ['prediction1', 'prediction2', 'prediction3', 'prediction4', 'prediction5']
  
  def form_valid(self, form):
          form.instance.user = self.request.user
          return super().form_valid(form)
  </code></pre>
  <p>class TourPronoWeek1UpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView):</p>
  <pre><code>model = PredictionWeek1
  template_name = 'folder/prediction1_update.html'
  
  fields = ['prediction1', 'prediction2', 'prediction3', 'prediction4', 'prediction5']
  
  
  def form_valid(self, form):
      form.instance.user = self.request.user
      return super().form_valid(form)
  
  def test_func(self):
      prediction = self.get_object()
      if self.request.user == prediction.user:
          return True
      return False
  </code></pre>
  <p>class PredictionWeek2CreateView(LoginRequiredMixin, CreateView):</p>
  <pre><code>model = PredictionWeek2
  
  fields = ['prediction1', 'prediction2', 'prediction3', 'prediction4', 'prediction5']
  
  def form_valid(self, form):
      form.instance.user = self.request.user
      return super().form_valid(form)
  </code></pre>
  <p>class PredictionWeek2UpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView):</p>
  <pre><code>model = PredictionWeek2
  template_name = 'folder/predictionweek2_update.html'
  
  fields = ['prediction1', 'prediction2', 'prediction3', 'prediction4', 'prediction5']
  
  def form_valid(self, form):
      form.instance.user = self.request.user
      return super().form_valid(form)
  
  def test_func(self):
      prediction = self.get_object()
      if self.request.user == prediction.user:
          return True
      return False
  </code></pre>
  <p>in models.py:</p>
  <p>#FYI:'startlist' is the list of athletes that compete and which the users can choose from</p>
  <p>class PredictionWeek1(models.Model):</p>
  <pre><code>prediction1 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction2 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction3 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction4 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction5 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  
  user = models.ForeignKey(User, on_delete=models.CASCADE)
  
  def clean(self):
      prediction = [self.prediction1, self.prediction2, self.prediction3, self.prediction4, self.prediction5]
  
      if len(prediction) != len(set(prediction)):
          raise ValidationError('Error, you have chosen the same athlete two times!')
  
  def __str__(self):
      return str(self.user)
  
  def get_absolute_url(self):
      return reverse('MyPrediction')
  </code></pre>
  <p>class PredictionWeek2(models.Model):</p>
  <pre><code>prediction1 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction2 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction3 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction4 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  prediction5 = models.CharField(verbose_name = False, max_length=100, choices = startlist)
  
  user = models.ForeignKey(User, on_delete=models.CASCADE)
  
  def clean(self):
      prediction = [self.prediction1, self.prediction2, self.prediction3, self.prediction4, self.prediction5]
  
      if len(prediction) != len(set(prediction)):
          raise ValidationError('Error, you have chosen the same athlete two times!')
  
  def __str__(self):
      return str(self.user)
  
  def get_absolute_url(self):
      return reverse('MyPrediction')
  </code></pre>
  <p>Thanks in advance!</p>