Featured resource
2026 Tech Forecast
2026 Tech Forecast

1,500+ tech insiders, business leaders, and Pluralsight Authors share their predictions on what’s shifting fastest and how to stay ahead.

Download the forecast
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Core Tech
Labs

Secured Interactions in a Django Meeting Planner

A small consultancy needs an internal tool to stop double-booking its two shared meeting rooms. You are handed a freshly generated Django project and must turn it into a working planner: routes that resolve meetings by ID and fail gracefully when they don't exist, a data model connecting meetings to rooms and attendees, an admin panel that shows the office manager how full each meeting is, browsable list and detail pages styled with the company's CSS, and forms that only logged-in users can use to create a meeting or, after confirming, delete one.

Lab platform
Lab Info
Level
Beginner
Last updated
Nov 19, 2026
Duration
1h 0m

Contact sales

By clicking submit, you agree to our Privacy Policy and Terms of Use, and consent to receive marketing emails from Pluralsight.
Table of Contents
  1. Challenge

    Step 1: Orientation to the Meeting Planner platform

    The double-booking problem

    A small consultancy shares two meeting rooms across every team, and right now the only booking system is a shared spreadsheet that people forget to update. Two teams show up to Room A at the same time, someone books a room that's already full for the afternoon, and nobody can see who is supposed to be in a meeting until they walk in. You have been handed a freshly generated Django project, meetplanner, and asked to turn it into the office's real booking tool.

    By the end of this lab the project will resolve meetings by id and fail gracefully when one doesn't exist, store meetings with their room and attendees in a real database, show that data through browsable pages styled with the company's CSS, and let only logged-in users create or delete a meeting. ### Touring the generated project

    Inside meetplanner/ you will find the pieces every Django request passes through:

    • views.py—the functions that turn an incoming request into a response.
    • urls.py—the routing table that maps a URL path to a view.
    • models.py—the Python classes that describe the database tables (Meeting, Room, Attendee).
    • admin.py—customization of the built-in admin site the office manager will use.
    • templates/meetplanner/ and static/meetplanner/—the HTML that renders and the CSS that styles it.

    The templates, URL routes, settings, and database configuration are already written so you can focus on the Python that ties them together. Several functions are stubbed with a # TODO comment marking exactly where your work goes.

    The project's dependencies are installed in a ready-made virtual environment, venv/. Every command in this lab calls its interpreter directly as venv/bin/python. ### Where you're headed

    Here's what you'll accomplish in the remaining steps:

    • Step 2: Get the server answering requests, view the application in the Web Browser tab, and add a meeting lookup route with a custom 404 response when an ID doesn't exist.
    • Step 3: Complete the Meeting model's string representation and query helper, add a field and migrate the database, and display an attendee count in the admin's meeting list.
    • Step 4: Render the landing, list, and detail pages using a shared base template and static CSS.
    • Step 5: Validate the booking form against overlapping room reservations, protect the create and delete flows with a login check, and add a confirmation step that only accepts a POST request for deletion.
    • Step 6: Log in and test every feature in the browser.

    Each step builds on the work completed in the previous step, so work through them in order.

  2. Challenge

    Step 2: Stand up the project and route core requests

    Answering the first request

    Django's development server can already start and serve the project, but status_view, the view behind /status/ in meetplanner/views.py, is unfinished.

    A status endpoint like this provides a simple way to verify that routing works from end to end: a request comes in, a view function runs, and a response goes back out. Here, the response uses JSON, a text format programs use to exchange data.

    A load balancer or monitoring tool could also check this endpoint to determine whether the service is responding, so it's worth getting right before building anything more elaborate on top of it. ### See the server answer

    The check called status_view directly. Now watch the same view answer a real HTTP request.

    1. In the Terminal, start the development server:

      venv/bin/python main.py
      

      main.py runs manage.py runserver 0.0.0.0:8001 --insecure. The --insecure flag allows the server to serve CSS files even though DEBUG is False. Keeping DEBUG set to False also ensures the project's custom 404 page is used.

      At startup, you'll see a warning about unapplied migrations. This is expected because the database tables haven't been created yet. You'll create them in Task 3.3. The server is ready when it prints Quit the server with CONTROL-C.

    2. Open the Web Browser tab, enter in the following address and press Enter.:

      localhost:8001/status/
      

      The tab's default address, localhost:8000, points to a different service. The page should display the JSON returned by your view:

      {"status": "ok", "service": "meetplanner"}
      

    The server reloads automatically whenever you save a file, so you can leave it running and return to the browser after completing each task. The lab has one terminal, so press Control+C to stop the server whenever you need to run another command. Restart it using the same command. ### Named routes and a graceful 404

    Django matches an incoming path against urlpatterns in urls.py and calls the matching view with any captured values, such as a meeting's id. The lookup route is already declared as path("lookup/<int:meeting_id>/", views.meeting_lookup, name="meeting_lookup"), and its name lets templates and redirects point to it without hard-coding the path. What the view still needs to decide is what happens when the id doesn't match anything. Raising Http404 hands control to Django's 404 handling, which—because DEBUG is False—renders the project's own templates/404.html and shows your message instead of a debug page or a server error. ### Summary

    With the server running, try the lookup route in the Web Browser tab. Navigate to localhost:8001/lookup/2/ to see Budget Review, then open localhost:8001/lookup/999/ to see the custom 404 page displaying Meeting not found.

    In this step, you ran the project from its provided virtual environment and followed a request through urls.py to a view and back. status_view returns JSON, while meeting_lookup resolves an ID from the URL or raises Http404. Next, you'll replace the hard-coded MEETINGS list with real database models.

  3. Challenge

    Step 3: Model and manage meeting data

    Modeling meetings, rooms, and attendees

    meetplanner/models.py already defines Meeting, Room, and Attendee as Django models with fields and foreign keys connecting them. A meeting belongs to one room and has many attendees.

    What's missing is a readable string representation, which Python gets from the model's __str__ method. Without one, admin messages and the Python shell show a generic value such as Meeting object (1), which doesn't identify the meeting or its room. ### A query helper for what's ahead

    Every page that lists meetings should show what's coming up, not a growing pile of history. Rather than repeating a filter-and-order query in every view, it belongs once on the model itself as a classmethod (a method you call on the class itself), so views.py can call Meeting.upcoming().

    django.utils.timezone.now() gives the current, timezone-aware moment to compare against. That is the correct way to compare datetimes in Django when USE_TZ is on, rather than Python's own datetime.now(). ### Changing the model means migrating the database

    A model class describes a table, but the table itself lives in db.sqlite3, and Django never changes it just because models.py changed. Migrations connect the two:

    • makemigrations compares your models with the migration files already in meetplanner/migrations/ and writes a new file describing the difference. The project ships with 0001_initial.py, which creates the Room, Meeting, and Attendee tables.
    • migrate applies every migration the database hasn't seen yet and records each one in a django_migrations table, so it runs exactly once. The first migrate also creates the tables for Django's built-in apps, such as users and sessions.

    The office manager wants room for a short agenda on each meeting. Adding it takes one line in the model and two terminal commands. If the server from Step 2 is still running, press Control+C in the Terminal first. ### Customizing the admin for daily use

    Django's admin site is generated automatically from your models, but the default list view only shows each row's string form. admin.py already registers MeetingAdmin with a list_display that includes a column called attendee_count -- a computed column that tells the office manager how full a meeting is without opening it. For that column, the admin calls the MeetingAdmin method of the same name with each Meeting row in turn.

  4. Challenge

    Step 4: Render meeting list and detail templates

    A shared base template and static CSS

    meetplanner/templates/meetplanner/base.html already defines the page shell: a navigation bar, a link to the project's static CSS file, and a {% block content %} that every other template fills in.

    Building pages by extending this base, rather than writing full HTML documents each time, is called template inheritance. Change the navigation once in base.html, and every page that extends it picks up the change.home_view is the first view to demonstrate this, rendering home.html, which extends base.html. ### Listing what's upcoming

    With Meeting.upcoming() built in Step 3, the list page's job is to fetch that queryset and pass it to a template. meeting_list.html (which already extends base.html) loops over the meetings under the context key "meetings" and links each title to its detail page with {% url 'meeting_detail' meeting.pk %}, using the named route from urls.py. ### Showing one meeting in full

    The detail page needs a single Meeting instance rather than a queryset, and it needs to fail the same way the lookup route did in Step 2 when the ID is wrong.

    get_object_or_404 does both jobs in one call: it fetches the record or raises Http404 automatically, so the view doesn't need its own try/except around Meeting.objects.get(). ### See the pages render

    Start the server again if it isn't running (venv/bin/python main.py). In the Web Browser tab, open localhost:8001/.

    The dark navigation bar and white content card come from style.css, linked once in base.html. The page reports There are currently 0 upcoming meetings.

    Choose Meetings in the navigation bar. The list page uses the same layout and shows No upcoming meetings. because the database is still empty. You'll add meetings through the admin and open their detail pages in Step 6.

  5. Challenge

    Step 5: Secure meeting forms and deletion flow

    Validating a booking before it saves

    meetplanner/forms.py already defines MeetingForm as a ModelForm over Meeting, which gives it fields and per-field validation for free. What it can't check automatically is a rule that spans multiple meetings: two bookings for the same room can't overlap in time. That kind of cross-field, cross-record rule belongs in the form's clean() method, which Django calls after individual field validation and before is_valid() returns its final answer. ### Creating meetings behind a login check

    @login_required is a decorator that wraps a view so Django checks for an authenticated session before the view runs. An anonymous request is redirected to LOGIN_URL in settings.py, /accounts/login/, which urls.py serves with Django's built-in login view.

    meeting_create is already decorated this way. The remaining work is what happens once a logged-in user submits the form: validating it, saving it, redirecting the user afterward, and showing errors when the form doesn't validate. ### Deleting only on a confirmed POST

    Deleting data is one action in this project that should never happen from a plain link click because a GET request can be triggered accidentally by a prefetch or a bookmark.

    The safe pattern is to let GET render a confirmation page and reserve the actual delete() call for a POST the user submits deliberately. Combined with the @login_required check, this ensures that only authenticated users can delete meetings through a POST request.

  6. Challenge

    Step 6: Run the application

    Use the whole planner

    Every task is graded, but you haven't yet used the planner the way the office manager will. In this step, you'll create an account, add data through the admin, and use each page you built.

    Prepare the database and an account

    In the Terminal, press Control+C first if the server is running. Make sure every migration is applied:

    venv/bin/python manage.py migrate
    

    If Task 3.3 already applied everything, this prints No migrations to apply. Then create an administrator account:

    venv/bin/python manage.py createsuperuser
    

    It asks for a username, an email address (press Enter to skip it), and a password twice. The password prompt shows nothing as you type. The output ends with Superuser created successfully.

    Start the server:

    venv/bin/python main.py
    ``` ### Try each feature in the Web Browser tab
    
    Open the **Web Browser** tab and enter the following in the address bar and press `Enter`. 
    
    

    localhost:8001

    
    Click the **Open in new tab** icon (↗) on the right side of the address bar to open the application in a separate browser tab.
    
    > **Note:** For each check below, return to the Code Lab's **Web Browser** tab, enter the corresponding path after `localhost:8001`, and click **Open in new tab** to open the page in a separate browser tab. Use the separate tab to interact with the application, as the embedded browser may prevent login and other form submissions from working correctly.
    
    1. **Status and lookup (Tasks 2.1, 2.2).** `/status/` shows `{"status": "ok", "service": "meetplanner"}`. `/lookup/2/` shows `Budget Review`, and `/lookup/999/` shows the custom 404 page displaying `Meeting not found`.
    
    2. **Login required (Task 5.2).** Go to `/meetings/create/`. Because you aren't logged in, you're redirected to the **Log in** page, with `?next=/meetings/create/` in the address. Log in with your superuser account, and you're sent to the **New Meeting** form. Its **Room** list is empty, so add rooms next.
    
    3. **Admin (Tasks 3.1, 3.3, 3.4).** Go to `/admin/`. Under **Meetplanner**, add two rooms, such as `Room A` and `Room B`. Then add a meeting in `Room A` that starts tomorrow, give it an agenda, and add two attendees in the rows at the bottom. The confirmation message names the meeting as `<title> (Room A)`, which comes from your `__str__` method. The **Agenda** field is there because of your migration, and the **Meetings** list shows `2` in the **Attendees** column.
    
    4. **Home and list (Tasks 3.2, 4.1, 4.2).** Choose **Home** in the navigation bar. It now reports `1` upcoming meeting. Choose **Meetings** to see it listed with its room and start time.
    
    5. **Detail and 404 (Task 4.3).** Select the meeting's title to open its detail page with the room, times, agenda, and attendees. Then change the address to `/meetings/999/` to see the custom 404 page.
    
    6. **Double-booking (Tasks 5.1, 5.2).** Choose **New Meeting** and book `Room A` for a time that overlaps your first meeting. The form returns with `This room is already booked at that time` and keeps what you entered. Switch the room to `Room B` and save. You should land on the new meeting's detail page.
    
    7. **Confirmed delete (Task 5.3).** On that detail page, choose **Delete this meeting**. The confirmation page appears, and the meeting remains in the list until you choose **Confirm delete**, which returns you to the list without it.
    
    8. **Logged out (Task 5.3).** Choose **Log out** in the navigation bar, then visit `/meetings/1/delete/`. You're redirected to the login page instead of the confirmation page. ### Run the checks yourself
    
    The lab ran each task's test as you went, but they are ordinary pytest tests you can run whenever you like. The lab has one terminal, so press `Control+C` to stop the server first. Then run the whole suite:
    
    ```bash
    venv/bin/python -m pytest -q
    

    The last line starts with 12 passed. To run one task's test:

    bash runTest.sh test_task_2_1
    

    Each failure names the task it belongs to, so the output tells you which step to go back to. One thing worth trying before you finish: break something on purpose and watch the corresponding check fail, then restore it. Knowing what a failure looks like is just as valuable as knowing what a passing check looks like.

    When you're done, everything you've written remains in the editor tabs, so you can revisit your work.

About the author

Tom is a staff author at Pluralsight helping to develop Hands-On content. Tom's background in software development, UI/UX, and instructional design was developed over the years while working as a faculty member at the School of Computing at Weber State University in Utah, and continues to grow as he develops Projects and Labs for Pluralsight. When he's not creating content to allow learners to gain real-life experience, he enjoys spending time with his family.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight