Opened 8 years ago

Closed 8 years ago

#26224 closed Bug (worksforme)

Tutorial Part 5 (Testing) Generates app_label error

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

Description

I have been walking through the Tutorial for Django, and upon reaching part 5 and introducing the first test case, I get this output (the directory I put the tutorial in is called 'demo')

RuntimeError: Model class demo.polls.models.Question doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

I tried adding a Meta section to the Question model, after doing some poking around in the docs.

class Question(models.Model):
    question_text = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')
    
    class Meta:
        app_label='polls'

But then I get this:

RuntimeError: Conflicting 'question' models in application 'polls': <class 'polls.models.Question'> and <class 'demo.polls.models.Question'>.

Change History (4)

comment:1 by Tim Graham, 8 years ago

Resolution: worksforme
Status: newclosed

Please see TicketClosingReasons/UseSupportChannels for ways to get help, thanks!

comment:2 by Eric Livingston, 8 years ago

Why was this closed? There's something missing in the tutorial, that prevents the tests from running correctly. I read that 1.9 introduces some restraints or requirements related to this app binding issue. Perhaps the tutorial has not been updated from 1.8 to accommodate that new requirement.

comment:3 by Eric Livingston, 8 years ago

Resolution: worksforme
Status: closednew

comment:4 by Tim Graham, 8 years ago

Resolution: worksforme
Status: newclosed

The tutorial works for me (and everyone else who's completed it since 1.9 was released). It looks like you made a mistake somewhere and this isn't the place to get help debugging that. Of course, if you get help and find that there is actually some problem, then by all means reopen the ticket and let us know what the problem is.

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