Django Quiz 2024

Dancing for joy at the prospect of another quiz.

Yesterday, I held another quiz at the December edition of Django London. The quiz is a regular tradition at our meetup, a way of having a more relaxed event in December and giving away some nice prizes. This was the sixth quiz that I’ve presented, and the seventh overall.

Here’s an action shot taken by my co-organizer Çağıl:

Me giving the quiz at Django London, 2024.

And below is the quiz itself, so you can try it at home. Answers follow at the end, with some extra explanation. Dates refer to December 2024, so if you’re reading in the future, take that into consideration.

Enjoy!

The quiz

1. What is the default port that runserver uses?

  1. 8080
  2. 8000
  3. 8888
  4. 404

2. In which month of this year was Django 5.1 released?

  1. May
  2. August
  3. October
  4. Undecember

3. What company initially developed Django?

  1. Instagram
  2. Mozilla
  3. Lawrence Journal-World
  4. ACME Web Frameworks Inc.

4. What is the CSS selector that ORs a list of selectors?

  1. :is()
  2. :or()
  3. :any()
  4. :is-one-of-these()

5. What is the name of the new middleware that requires authentication by default?

  1. LoginRequiredMiddleware
  2. AuthenticationMiddleware
  3. PrivateEverywhereMiddleware
  4. FinallyNoMoreAccidentallyPublicViewsMiddleware

6. What is the name of the Django contributor accelerator program?

  1. Djangonaut Space
  2. Pony Express
  3. Astronaut Django
  4. All Djangoes Go

7. Which model field would you use to store unbounded textual data?

  1. CharField
  2. TextField
  3. BinaryField
  4. LongOrEvenInfiniteTextField

8. Which of these is not a real Django contributor team?

  1. Accessibility
  2. Oops
  3. Security
  4. Triage & Review

9. What is the new template tag to modify a URL’s query parameters?

  1. {% alterqueryparams %}
  2. {% urlparams %}
  3. {% querystring %}
  4. {% q %}

10. Which class would extend to create a custom management command?

  1. BaseCommand
  2. ManagePyCommand
  3. AdminCommand
  4. Custom

11. In which city will DjangoCon Europe 2025 be held?

  1. Trondheim, Norway
  2. Porto, Portugal
  3. Dublin, Ireland
  4. Canberra, Australia

12. Which model class attribute contains the public API for metadata?

  1. _meta
  2. meta
  3. Meta
  4. metadata_please

Answers

But first, some vertical space.

A

N

S

W

E

R

S

B

E

L

O

W

Okay, now the answers

1. What is the default port that runserver uses?

The runserver command uses port 8000 by default.

2. In which month of this year was Django 5.1 released?

Django 5.1 was released in August.

3. What company initially developed Django?

Django was initially developed within Lawrence Journal-World, a daily newspaper in Lawrence, Kansas. See Simon Willison’s history of Django post for the quite unusual story.

4. What is the CSS selector that ORs a list of selectors?

The CSS pseudo-class function that ORs a list of selectors is :is(). For example, to affect all icons within any heading element, <h1> through <h6>, you could use:

/* Icons in headings */
:is(h1, h2, h3, h4, h5, h6) .icon {
    margin-inline: 0.5em;
}

5. What is the name of the new middleware that requires authentication by default?

The new middleware that requires authentication by default is LoginRequiredMiddleware. A really useful feature that fixes a longstanding criticism of Django’s security defaults. It is still opt-in, and will require many third-party packages to adapt their public views, but I’m excited.

6. What is the name of the Django contributor accelerator program?

The Django contributor accelerator program is called Djangonaut Space. They have done some amazing things helping new contributors get started with Django, and they even collectively won the Malcolm Tredinnick Memorial Prize last year.

7. Which model field would you use to store unbounded textual data?

To store unbounded textual data, use TextField. CharField has a limit, whilst TextField does not.

8. Which of these is not a real Django contributor team?

The team that is not a real Django contributor team is "Oops". It’s actually "Ops", for operations—they keep the website and other infrastructure running!

9. What is the new template tag to modify a URL’s query parameters?

The new-in-Django-5.1 template tag to modify a URL’s query parameters is {% querystring %}. For example, you can use it like this when paginating:

<a href="{% querystring page=page.next_page_number %}">Next page</a>

If the URL was already /tech/?search=biscuits&page=1, the above would output a link where page was replaced with the next number:

<a href="/whatever/?search=biscuits&page=2">Next page</a>

10. Which class would extend to create a custom management command?

To create a custom management command, you would extend the BaseCommand class, per the custom management commands tutorial.

11. In which city will DjangoCon Europe 2025 be held?

DjangoCon Europe 2025 will be held in Dublin, Ireland. See you there?

12. Which model class attribute contains the public API for metadata?

The model class attribute that contains the public API for metadata is _meta, per the Model _meta API documentation. The underscore prefix is typically used in Python to mark things as “private” or “internal”. In this case, Django had the API for some number of versions, third-party packages started using it, and so parts were formalized as public in Django 1.8.

Use this API to get details defined in internal Meta classes, like the plural verbose name:

>>> Octopus._meta.verbose_name_plural
'octopuses'

Fin

I hope you have enjoyed reading or doing this quiz. If you want more, see the previous years’ quizzes in the “related posts” section below.

—Adam


😸😸😸 Check out my new book on using GitHub effectively, Boost Your GitHub DX! 😸😸😸


Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Related posts:

Tags: