Opened 8 years ago

Closed 8 years ago

Last modified 4 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

Description

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 8 years ago by James Bennett

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 8 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 Changed 8 years ago by Jacob

Resolution: invalid
Status: newclosed

comment:4 Changed 4 years ago by anonymous

Easy pickings: unset
Severity: Normal
Type: 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