Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8288277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:14:57+00:00 2026-06-08T12:14:57+00:00

Working on the Django tutorial Writing your own Django app, and I’m on Part

  • 0

Working on the Django tutorial “Writing your own Django app,” and I’m on Part 2.

Midway through, it instructs me to add a line to the admin so that the admin will recognize not just Poll (and PollAdmin, which the tutorial has been configuring for some custom poll-presenting options), but also Choice. Here’s the (short) updated admin.py:

from polls.models import Poll
from polls.models import Choice
from django.contrib import admin

class PollAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,                  {'fields': ['question']}),
        ('Date information',    {'fields': ['pub_date'], 'classes': ['collapse']}),
        ]

admin.site.register(Poll, PollAdmin)
admin.site.register(Choice)

Looking at this, I can’t figure out why I can’t simply write

admin.site.register(Poll, PollAdmin, Choice)

except that this gives me a TypeError, because

register() takes at most 3 arguments (4 given)

This seems really… arbitrary to me. I don’t understand why register only takes at most 3 arguments. My understanding of Django is still at a very voodoo, cargo-cult level, so I get that this Just. Doesn’t. Work., but I was wondering if some light could be shed on why I can’t pull all three elements from admin.site at the same time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:14:59+00:00Added an answer on June 8, 2026 at 12:14 pm

    Because you’ve got two separate types of registration going on here, with two separate types of objects. I think you’re thinking that this is saying “register these three things with the admin”, but that’s not quite what’s going on.

    The first line is saying “register the Poll model with the admin, using the PollAdmin class I’ve defined.”

    The second line is saying “register the Choice model with the admin, using the default settings.”

    So it wouldn’t make sense to have them all in the same line. You’re only registering one model at a time, but one uses some explicit options, and the other uses the default options.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working through the Django tutorial and receiving the following error when I run
After working through the Django tutorial I'm now trying to build a very simple
I am currently working through the tutorial on Django's website. Upon completing the following
I installed Django, and started working through the tutorial. It told me that I
Using: Ubuntu 11.04 Django 1.3 Python 2.7 Following the tutorial at Writing your first
I am currently working my way through the Django Tutorial (Step 3) and am
I'm (slowly!) working my way through the Django tutorial, and I've reached the point
I'm following the Django-CMS introductory tutorial and have got everything working up to the
I'm new to Django but am working on the tutorial on the Django website
I'm working on a django app for a site that requires an image gallery.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.