Opened 16 years ago

Closed 16 years ago

Last modified 12 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 by James Bennett, 16 years ago

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

milestone: post-1.0

Milestone post-1.0 deleted

comment:3 by Jacob, 16 years ago

Resolution: invalid
Status: newclosed

comment:4 by anonymous, 12 years ago

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