Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#10124 closed Uncategorized (invalid)

ModelForm documentation horribly unclear for foreign key models

Reported by: ColinAlston Owned by: nobody
Component: Documentation Version: 1.0
Severity: Normal Keywords: ModelForm
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The only way I found this out was by swearing profusely in #django. *Please* document it.

The current documentation rather tenuously approaches the subject with the whole Author thing which is just too simplistic to demonstrate the usage.

# -- Model --
class Colour(models.Model):
    colour_name = models.CharField(max_length=200)

class Fruit(models.Model):
    fruit_name = models.CharField(max_length=200)
    fruit_colour = models.ForeignKey(Colour, blank=True, null=True)

# -- View -- 
class AddFruitForm(forms.ModelForm):
    class Meta: 
        model = Fruit

    fruit_colour = forms.ModelChoiceField(queryset=Colour.objects.order_by('colour_name'))

Change History (4)

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This ticket doesn't actually explain any problem with the documentation, or what the solution to the problem was; it's just a code sample. Please provide an explanation of:

  1. What problem you ran into.
  2. How the documentation didn't help you solve it.
  3. How you did actually solve it, so we can look into documenting it if it turns out to be a common problem.

comment:2 Changed 7 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

comment:3 Changed 7 years ago by jacob

  • Resolution set to invalid
  • Status changed from new to closed

comment:4 Changed 3 years ago by anonymous

  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset

And even four years later, no development in the documents regarding this issue! Just wasted an enormous amount of time!

Note: See TracTickets for help on using tickets.
Back to Top