title: Allow empty foreign key selection in admin forms
body: <p>I created a model(AnalysisFieldTemplate) with a foreign key to AnalysisFieldRule.
  What i want is to have the possibility to leave the field display_analysis_field_rule blank and save my admin form.</p>
  <pre><code>class AnalysisFieldRule(models.Model):
      action_kind: str = models.CharField(
          choices=ActionKind.choices,
          default=ActionKind.DISPLAY,
          max_length=text_choices_max_length(ActionKind),
          verbose_name=_(&quot;action kind&quot;),
      )
      formula: str = formula_field()
      name: str = models.CharField(max_length=MAX_NAME_LENGTH, verbose_name=_(&quot;name&quot;))
  
      def __str__(self):
          return f&quot;{self.name}: {ActionKind(self.action_kind).label}&quot;
  
      class Meta:
          constraints = [
              UniqueConstraint(fields=(&quot;action_kind&quot;, &quot;name&quot;), name=&quot;%(app_label)s_%(class)s_is_unique&quot;),
          ]
          ordering = [&quot;name&quot;, &quot;action_kind&quot;]
          verbose_name = _(&quot;analysis field rule&quot;)
          verbose_name_plural = _(&quot;analysis field rules&quot;)
  
  class AnalysisFieldTemplate(models.Model):
      display_analysis_field_rule: AnalysisFieldRule = models.ForeignKey(
          AnalysisFieldRule,
          blank=True,
          limit_choices_to={&quot;action_kind&quot;: ActionKind.DISPLAY},
          null=True,
          on_delete=models.PROTECT,
          related_name=&quot;display_analysis_field_templates&quot;,
          verbose_name=_(&quot;display rule&quot;),
      ) 
  </code></pre>
  <p>Now here is the problem. If i try to save my admin form without choosing one a value for display_analysis_field_rule it will result in an Validationerror.
  It seems that the standard empty value for a foreign key &quot;------&quot; is not a valid choice.</p>
  <p><a href="https://i.stack.imgur.com/VhhaJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VhhaJ.png" alt="enter image description here" /></a></p>
  <pre><code>@admin.register(AnalysisFormTemplate)
  class AnalysisFieldTemplateAdmin(admin.ModelAdmin):
      fieldsets = (
          (
              None,
              {
                  &quot;fields&quot;: (
                      &quot;name&quot;,
                      &quot;name_for_formula&quot;,
                      &quot;ordering&quot;,
                      &quot;required&quot;,
                      &quot;kind&quot;,
                      &quot;display_analysis_field_rule&quot;,
                      &quot;highlight_analysis_field_rule&quot;,
                  )
              },
          ),
          (
              _(&quot;Text options&quot;),
              {&quot;fields&quot;: (&quot;max_length&quot;,)},
          ),
          (
              _(&quot;Integer options&quot;),
              {&quot;fields&quot;: (&quot;min_integer_value&quot;, &quot;max_integer_value&quot;)},
          ),
          (_(&quot;Amount of money options&quot;), {&quot;fields&quot;: (&quot;min_amount_of_money&quot;, &quot;max_amount_of_money&quot;)}),
      )
  </code></pre>
  <p>I debugged a little deeper and found that the &quot;to_python&quot; compares the choosen value with pythons standard &quot;empty_values&quot; but of course it contains not the &quot;------&quot; and it will handle it as a normal id which results in an Validation error.</p>
  <p>My question is how can i make it possible to save my form without choosing a value for my foreign key? Do i have to override the &quot;to_python&quot; function? What would be a best practice here?</p>
  <p>I appreciate all the help :)</p>